Nick Lim Posted June 21, 2003 Posted June 21, 2003 What is the easiest way to implement a link at footer.php to enable it to go to the top of the page currently viewed?
freelancerx Posted June 21, 2003 Posted June 21, 2003 Hmmm... I am no osc expert, but... Place the following code in footer.php: <a href="#top">Back to Top</a> My browser automatically sets "top", so I usually don't define it, but that doesn't mean all browsers will do it that way. Bad habit not to define it, I guess. So, you would probably add the following code to header.php: <a name="top"></a> I think that would do it... ? -Michael This is my signature. :P
Nick Lim Posted June 22, 2003 Author Posted June 22, 2003 Thanks Michael. I already tried that but it does not work. However, I managed to get it to work by carrying out the following; I added the statement <?php echo $breadcrumb->lbctop(' » '); ?> to footer.php. Then I amended the catalog/include/classes/breadcrumb.php file to include the following which is modified from the function trail($separator = ' - '). //Amended by lbc - link to go to top of page function lbctop($separator = ' - ') { $trail_string = ''; $p=sizeof($this->_trail)-1; for ($i=$p, $n=sizeof($this->_trail); $i<$n; $i++) { if (isset($this->_trail[$i]['link']) && tep_not_null($this->_trail[$i]['link'])) { $trail_string .= '<a href="' . $this->_trail[$i]['link'] . '" class="headerNavigation2">' . tep_image(DIR_WS_IMAGES . 'buttontop.gif', LINK_PROFILE) . '</a>'; } else { $trail_string .= $this->_trail[$i]['title']; } if (($i+1) < $n) $trail_string .= $separator; } return $trail_string; } You will need an image button called 'buttontop.gif' if you are using the above code. I am wondering if there is any other easier and more effective method to implement this!
ashlyn Posted June 23, 2003 Posted June 23, 2003 I was going to suggest the a href link too. Can't see why it wouldn't work ------------------------------------------------------- I used to be insane, but now I'm just nuts ;)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.