Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Roll Over Catagory Images


JEWbacca

Recommended Posts

Hello. I'm trying to add mouse rollover links on the catagory pages.

 

Here is the original code from the index.php file...

 

echo '                <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n";
    if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
      echo '              </tr>' . "\n";
      echo '              <tr>' . "\n";
    }
  }

 

I have changed this to:

 

echo '<td align="center" class="smallText" width="'.$width.'" valign="top">'.
'<a href="'.tep_href_link(FILENAME_DEFAULT, $cPath_new).'" onMouseOver="turnOn(\'image1\')" onMouseOut="turnOff(\'image1\')>'.
'tep_image(DIR_WS_IMAGES.$categories[\'categories_image\'], $categories[\'categories_name\'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . <br> . $categories[\'categories_name\'].'\n';

// This is the javascript
<script language="JavaScript">
<!--
if (document.images) {
image1on = new Image();
image1on.src = "DIR_WS_IMAGES.$categories['categories_name']";
image1off = new Image();
image1off.src = "DIR_WS_IMAGES/rollovers/$categories['categories_name']";
}
function turnOn(imageName) {
if (document.images) {
  document[imageName].src = eval(imageName + "on.src");
}
}
function turnOff(imageName) {
if (document.images) {
  document[imageName].src = eval(imageName + "off.src");
}
}
// -->

 

My logic in this was to create a folder within my defined image directory called 'rollovers' and then place files with the EXACT same name as the original category image in that folder.

 

Is my logic and code completely wrong?

 

I have created a 'test' index, as my store is live and called in 'index_roll.php' it is located at www.blackwidowsecurity.com/store/index_roll.php

 

As of now i'm getting this error:

 

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/blackwid/public_html/store/index_roll.php on line 107

 

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/blackwid/public_html/store/index_roll.php on line 107

 

and my line 107 is:

 

'tep_image(DIR_WS_IMAGES.$categories[\'categories_image\'], $categories[\'categories_name\'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . <br> . $categories[\'categories_name\'].'\n';

 

Does anyone have any idea/ suggestions/ their own similar code working?

 

Thanks,

 

Nate

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...