Thread: Anchor Links

Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Anchor Links

    I'm trying to set up some anchor linking on my product info display page and can not seem to get the syntax right.

    I've been trying to follow w3schools.com on this and its not exactly working... can someone show me the error of my ways please:

    <?php echo '<a href="#reviews"' . 'Read all reviews' . '</a>'; ?>

    <?php echo '<a name="reviews"' . TEXT_PRODUCT_REVIEWS . '</a>'; ?>
    Thank you,
    autoace

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Anchor Links

    I don't know about a PHP version, but it's just a special form of the HTML 'anchor' tag, which you should be able to insert into tpl_product_info_display.php. You would put the first line where you want the link to take the visitor, and the second where you want the link:

    <a name="top">top</a>

    Create your link and make sure you use the same name as you used in your anchor:

    <a href="#top">Go to Top of Page</a>

    I have had browser incompatibilty issues with that tag.

  3. #3
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Re: Anchor Links

    I tried just the simply html way, not working either. I tried my php versions because I didn't think the simple one would. Right now neither are working... I think it has something to do with the path.

    When I hover over the link, it reads mydomain.com/#reviews and then when I click on it, it goes to the home page not the reviews section at the bottom.

    For now, I'm working on some other things, if you have any suggestions please do so, thanks.
    Thank you,
    autoace

  4. #4
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Anchor Links

    Quote Originally Posted by autoace View Post

    <?php echo '<a href="#reviews"' . 'Read all reviews' . '</a>'; ?>

    <?php echo '<a name="reviews"' . TEXT_PRODUCT_REVIEWS . '</a>'; ?>
    In zen cart anchor links need to be called in a specific way to work.

    for your product info page:
    <a href="<?php echo zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('number_of_uploads')) ) . '#reviews'; ?>"><?php echo TEXT_READ_REVIEWS; ?></a>

    I use this to return to top of page:
    <a name="reviews"><?php echo TEXT_PRODUCT_REVIEWS; ?></a><a href="#" id="productInfoTop" onclick="window.scrollTo(0,0); return false"> Back to Top</a>

    hope this helps!

 

 

Similar Threads

  1. v154 Tabbed Prod Pro (TPP): Adding Anchor Links
    By Feznizzle in forum All Other Contributions/Addons
    Replies: 10
    Last Post: 30 May 2016, 07:50 PM
  2. Html anchor links in product pages
    By petek in forum General Questions
    Replies: 0
    Last Post: 22 Apr 2011, 04:28 PM
  3. Using Anchor Links in Ezpages
    By JollyJim in forum Templates, Stylesheets, Page Layout
    Replies: 20
    Last Post: 14 Nov 2009, 06:39 PM
  4. Using Anchor links in Ez-Pages
    By batteryman in forum General Questions
    Replies: 10
    Last Post: 10 Nov 2009, 10:32 AM
  5. creating anchor links in defined pages like shippinginfo.html
    By shocker in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 7 Dec 2008, 11:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg