JEWbacca Posted April 13, 2005 Posted April 13, 2005 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'].'</a></td>\n'; // This is the 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? As of now i'm getting this error: Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/blackwid/public_html/store/index.php on line 106 and my line 106 is: '<a href="'.tep_href_link(FILENAME_DEFAULT, $cPath_new).'" onMouseOver="turnOn('image1')" onMouseOut="turnOff('image1')>'. Does anyone have any idea/ suggestions/ their own similar code working? Thanks, Nate
dblake Posted April 13, 2005 Posted April 13, 2005 and my line 106 is: '<a href="'.tep_href_link(FILENAME_DEFAULT, $cPath_new).'" onMouseOver="turnOn('image1')" onMouseOut="turnOff('image1')>'. <{POST_SNAPBACK}> '<a href="'.tep_href_link(FILENAME_DEFAULT, $cPath_new).'" onMouseOver="turnOn(\'image1\')" onMouseOut="turnOff(\'image1\')>'. Try that, pay attention to the \ -Dennis
JEWbacca Posted April 14, 2005 Author Posted April 14, 2005 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"); } } // --> 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
JEWbacca Posted April 15, 2005 Author Posted April 15, 2005 ----- anyone in the day/night crew? --------
Recommended Posts
Archived
This topic is now archived and is closed to further replies.