Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25
  1. #11
    Join Date
    May 2008
    Posts
    402
    Plugin Contributions
    0

    Default Re: Calling the current product page url with php

    Quote Originally Posted by DrByte View Post
    So is your *real* question actually about how to properly create a named anchor link within a page? There are numerous threads on that topic.
    Found this thread but it seems that would only work on a static page, not on a product page right? Using the code above it pulls whatever the product page URL is and adds the div tag (anchor) to the end so that no matter how many different product pages you make it will always pull that page's url.

  2. #12
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Calling the current product page url with php

    <a href="<?php echo $_SERVER['PHP_SELF']; ?>" class="links">Text Here </a>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    Play with it long enough and you will break it.

  3. #13
    Join Date
    May 2008
    Posts
    402
    Plugin Contributions
    0

    Default Re: Calling the current product page url with php

    Quote Originally Posted by usernamenone View Post
    <a href="<?php echo $_SERVER['PHP_SELF']; ?>" class="links">Text Here </a>
    Thanks. What's the difference between that and this? <?php echo $_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']; ?>

  4. #14
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: Calling the current product page url with php

    .

    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.

  5. #15
    Join Date
    Dec 2011
    Posts
    7
    Plugin Contributions
    0

    Default Re: Calling the current product page url with php

    Quote Originally Posted by swguy View Post
    ... and indeed, such a link should not use the current page information.

    Read <a href="#more">more here</a> ...

    ...

    <a name="more"></a>
    Here's more ....
    I want to use anchor tags to let users jump to a different section of a long product page. This simple html isn't working on my page. It tries to jump to "http://mysite.com/#more" instead of "http://mysite.com/index.php?main_page=product_info&cPath=1&products_id=15/#more"

    What am I doing wrong?

  6. #16
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Calling the current product page url with php

    <a name="anchor1">to anchor1 Section</a>

    <a href="#anchor1">Visit the anchor1 Section</a>

    You will need to determine your placements
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    Play with it long enough and you will break it.

  7. #17
    Join Date
    Dec 2011
    Posts
    7
    Plugin Contributions
    0

    Default Re: Calling the current product page url with php

    Quote Originally Posted by usernamenone View Post
    <a name="anchor1">to anchor1 Section</a>

    <a href="#anchor1">Visit the anchor1 Section</a>

    You will need to determine your placements
    That should work. It works on regular HTML pages.

    I've tried it and it didn't work with a zencart PRODUCT.

    It brings me to "http://mysite.com/#anchor1"

    It does not go to
    "http://mysite.com/index.php?main_page=product_info&cPath=1&products_id=15/#anchor1"


    Do I really need to code it like this?

    <a href="mysite.com/index.php?main_page=product_info&cPath=1&products_id=15/#anchor1">Visit the anchor1 Section</a>

    <a name="anchor1">to anchor1 Section</a>

  8. #18
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Calling the current product page url with php

    Quote Originally Posted by skidude View Post
    I want to use anchor tags to let users jump to a different section of a long product page. This simple html isn't working on my page. It tries to jump to "http://mysite.com/#more" instead of "http://mysite.com/index.php?main_page=product_info&cPath=1&products_id=15/#more"

    What am I doing wrong?
    You don't need php for the code. You add your product description in admin within the description you are using html not php.

    That script works and if you can not get it to then you are not using it in the right manor.

    <a name="anchor1">to anchor1 Section</a>And here is long text that goes down the page, bla bla bla

    and this is the anchor that goes back to anchor1
    <a href="#anchor1">Visit the anchor1 Section</a>

    And if this is not what you want to do then you need to explain it in a different manor
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    Play with it long enough and you will break it.

  9. #19
    Join Date
    Dec 2011
    Posts
    7
    Plugin Contributions
    0

    Default Re: Calling the current product page url with php

    Thanks for the help.

    What script are you referring to? Do you mean the href call?

    I copied your href code and put it in the product description.

    I think that I must be missing something that is very obvious.

    Here are two screen shots. One is the product creation and the other is it displayed.
    =========================================



    =========================================



    Notice it doesn't want to link to "http://mysite.com/zen2/index.php?main_page=product_info&cPath=1&products_id=1#anchor1"

  10. #20
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Calling the current product page url with php

    So then you have to ask yourself what other files you have messed with? without a link to your site I can't guess.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    Play with it long enough and you will break it.

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. v151 with ultimate seo Url,how to change the ez-page url ?
    By whywell in forum General Questions
    Replies: 1
    Last Post: 17 Jan 2013, 09:12 AM
  2. v150 what is the php code to return the url of the current page?
    By WebKat in forum General Questions
    Replies: 7
    Last Post: 8 Mar 2012, 11:24 PM
  3. how to get the value of current category with PHP code?
    By mybiz9999 in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 16 Feb 2011, 05:27 PM
  4. Highlight the Current Page with CSS
    By FoodDudes in forum Templates, Stylesheets, Page Layout
    Replies: 12
    Last Post: 28 Feb 2010, 01:13 AM
  5. Replies: 1
    Last Post: 22 Mar 2007, 05:37 PM

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