Thread: In page links

Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2005
    Posts
    86
    Plugin Contributions
    1

    Default In page links

    Hope someone can help me?, hope I can explain my problem properly!

    I'm trying to create inpage links (name Anchors) on my Product Info page.

    I've added the named anchors to my tpl_product_info_display.php page, and I've managed to get the first part of the URL, to return to the correct page.

    /index.php?main_page=product_info/(missing this bit) #pagetop

    but I can't get the middle bit, the product info path

    e.g
    &cPath=1_9&products_id=26


    Does anyone have any suggestions??


    ADDED

    After a bit more work I've come up with this

    <?php
    echo '<a href="' . zen_href_link( "product_info&cPath=$cPath&",'products_id=' . $_GET['products_id']) . '#pagetop" >Page Top</a>';?>

    Is this code OK? it works and everything seems OK, I can add products to cart and the links work etc, but I would like a more experieced coder to have a look and make sure its OK!!
    Last edited by steveyork136; 22 Jul 2006 at 11:11 AM. Reason: Did more work

  2. #2
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: In page links

    This would be more correct, but is only a minor change:
    PHP Code:
    <?php
    echo '<a href="' zen_href_link'product_info''cPath=' $cPath '&amp;products_id=' $_GET['products_id']) . '#pagetop" >Page Top</a>';?>
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Nov 2005
    Posts
    86
    Plugin Contributions
    1

    Default Re: In page links

    Many Thanks DrByte.

    I nearly got it right

  4. #4
    Join Date
    May 2004
    Posts
    766
    Plugin Contributions
    0

    Default Re: In page links

    How would this work on links within the same document, i.e. FAQs?

    I have a one page document that I have in the html includes folder that is an FAQ question and answer kind of page.

    I tried it with putting in the anchors the usual way as you would in an html page and it just keeps going back to the pain page when you click on a question instead of moving to the spot in the same page that has the answer.

    For example, before a question I have:

    <a href="#difference" class="questions">

    and before the answer I have:

    <a name="difference">repeat the question text here</a>


    Thank You,

    Betty

  5. #5
    Join Date
    Nov 2005
    Posts
    86
    Plugin Contributions
    1

    Default Re: In page links

    Might be an easier way but this works

    HTML Code:
    <a href="./index.php?main_page=page_2#difference" class="questions">Link here</a>
    Best check this and make sure it works if customers logged in or has stuff in their cart

  6. #6
    Join Date
    Nov 2005
    Posts
    86
    Plugin Contributions
    1

    Default Re: In page links

    oops forgot,

    change the "page_2" bit to your page name

  7. #7
    Join Date
    Mar 2006
    Posts
    919
    Plugin Contributions
    2

    Default Re: In page links

    Quote Originally Posted by DrByte View Post
    This would be more correct, but is only a minor change:
    PHP Code:
    <?php
    echo '<a href="' zen_href_link'product_info''cPath=' $cPath '&amp;products_id=' $_GET['products_id']) . '#pagetop" >Page Top</a>';?>
    I've just tried this code and had to change the &amp; to the actual & symbol. Otherwise it wouldn't work!

    Have I done something wrong?

  8. #8
    Join Date
    Sep 2007
    Posts
    21
    Plugin Contributions
    1

    Idea or Suggestion Re: In page links

    Quote Originally Posted by steveyork136 View Post
    Hope someone can help me?, hope I can explain my problem properly!

    I'm trying to create inpage links (name Anchors) on my Product Info page.
    Quote Originally Posted by bettysue View Post
    How would this work on links within the same document, i.e. FAQs?
    Betty's simple named anchors code should work, the reason it doesn't however is because of zen cart's handling of links.
    because zen cart uses a <base> tag, all relative links are relative to that base rather than the current document. it's so all the links to included css and js files are simpler but it ruins simple in-page links like those.

    zen cart would be better off making all relative links relate to the site root e.g
    href="/some/path/"
    rather than
    href="some/path/"

    i used a quick fix where the catalogue was not in a subfolder of the site,
    in includes/template/your_template/common/html_header.php comment out the <base> tag, ensure there is a / after the first " of each stylesheets' href and the javascripts' src attributes.

    i am working on a proper fix for it so zen-cart can avoid that awful <base> tag

  9. #9
    Join Date
    Feb 2007
    Posts
    159
    Plugin Contributions
    0

    Default Re: In page links

    This fits exactly what I was going to ask today. I also have a FAQ page that I had anchors for but that didn't work. Has the solution presented in the entry above mine been finalized and it works?

    Beth-katherine

 

 

Similar Threads

  1. v150 locating specific home page image/links (currently dead links)
    By irish_1985 in forum Templates, Stylesheets, Page Layout
    Replies: 12
    Last Post: 15 Sep 2012, 09:59 PM
  2. Adding Page 2, Page 3 and Page 4 links to Information Box
    By MillenniumJim in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 16 Feb 2012, 07:47 AM
  3. Decorating EZ Page links the same as Category Links
    By klim in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 7 Mar 2011, 07:08 PM
  4. Removing category image links and text links from the HOME page
    By EddieMac in forum Basic Configuration
    Replies: 2
    Last Post: 24 Apr 2008, 02:53 PM
  5. Links Manager 1.5 - submit links page problem
    By heavenlynights in forum Addon Sideboxes
    Replies: 2
    Last Post: 2 Jan 2007, 12:47 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