1
jeffgr
How to align search icons? (some nice icons too...)
  • 2006/10/21 12:05

  • jeffgr

  • Quite a regular

  • Posts: 263

  • Since: 2004/2/22


Hi there,

I have replaced the search results icons that appear on a users profile page with some icons of my own. Free free to grab these icons by right-clicking, and then replacing the corresponding file for each (view source of image to see where that is).

http://myottawa.ca/userinfo.php?uid=1

One tiny thing is bothering me...the icons are not totally aligned with the text...I believe the images need to be text aligned to the "absolute middle"... but how to do this?

In the file userinfo.php, I found this code at line 200:



// Hack by marcan : only return results of modules for which user has access permission
if ( $gperm_handler->checkRight('module_read', $mid, $groups)) {
$module =& $module_handler->get($mid);
$results =& $module->search('', '', 5, 0, $thisUser->getVar('uid'));
$count = count($results);
if (is_array($results) && $count > 0) {
for ($i = 0; $i < $count; $i++) {
if (isset($results[$i]['image']) && $results[$i]['image'] != '') {
$results[$i]['image'] = 'modules/'.$module->getVar('dirname').'/'.$results[$i]['image'];
} else {
$results[$i]['image'] = 'images/icons/posticon2.gif';
}

if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
$results[$i]['link'] = "modules/".$module->getVar('dirname')."/".$results[$i]['link'];
}


I believe that it is somewhere in here that I have to give this property to an image...but where? This is what a regular image aligned this way looks like:



Where do I put the align="absmiddle" in this case then?

Thanks for your help!

Jeff

2
zyspec
Re: How to align search icons? (some nice icons too...)
  • 2006/10/21 21:02

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


First, Let me state - I haven't tried this on my installation but this should work...

There are 2 places you need to add the style to the html img tag - both in /search.php. Depending on the version of XOOPS you have, somewhere around line 176 & line 238 you'll need to make the following changes inside the 'for' loop(s).
for ($i 0$i $count$i++) {
[
b][color=0000FF]  echo '
';[/color][/b]
  if (isset(
$results[$i]['image']) && $results[$i]['image'] != "") {
  echo 
".$module->getVar('dirname')."/".$results[$i]['image']."' alt='".$myts->makeTboxData4Show($module->getVar('name'))."'[b][color=0000FF] style='vertical-align: middle;'[/b][/color] /> ";
  } else {
    echo 
"))."' width='26' height='26' /> ";
  }
  if (!
preg_match("/^http[s]*:///i"$results[$i]['link'])) {
    
$results[$i]['link'] = "modules/".$module->getVar('dirname')."/".$results[$i]['link'];
  }
  echo 
".$results[$i]['link']."'>".$myts->makeTboxData4Show($results[$i]['title'])."n";
  echo 
"";
  
$results[$i]['uid'] = @intval($results[$i]['uid']);
  if ( !empty(
$results[$i]['uid']) ) {
    
$uname XoopsUser::getUnameFromId($results[$i]['uid']);
    echo 
"  .XOOPS_URL."/userinfo.php?uid=".$results[$i]['uid']."'>".$uname."n";
  }
  echo !empty(
$results[$i]['time']) ? " ("formatTimestamp(intval($results[$i]['time'])).")" "";
  echo 
"
[b][color=0000FF]
[/b][/color]n"
;
}

Login

Who's Online

276 user(s) are online (240 user(s) are browsing Support Forums)


Members: 0


Guests: 276


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits