X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   HTML Anchors not working on static pages (https://forum.x-cart.com/showthread.php?t=23630)

MCM 07-27-2006 09:54 AM

HTML Anchors not working on static pages
 
Hi,

I'm creating an FAQ page, and would like to have all the questions at the top, each a link to the full question with answer. I put the list together, with each bullet looking like the following:


There is then an <a name="invest"> tag in the question, like this:

Code:

  <p align="left"><a name="invest"><font size="3">Q. What should I invest in? Which coins are
    going up in value? Where do you think the price of gold and silver are going
    to?

    A. We buy and sell coins. No one can predict the future,
    so we refrain from saying what is going up or down and which direction gold
    and silver are moving. Coins are a hobby, so enjoy them. Buy the best quality
    you can afford and stay away from problem coins. You’ll do just fine.</font></p>


But, when I click the link in a browser, this is the link that shows up:

http://www.jmscoins.com/#invest

The link isn't relative to the page like it should be. I commented out the list of links on the live page, but copied the page so you can take a look here. If anyone can help, I'd really appreciate it.

Thanks,

Jeremy

MCM 07-27-2006 10:01 AM

I also just noticed that this problem also happens within the item descriptions. I have a link setup to scroll to the detailed images, but that also goes to http://www.jmscoins.com/#images, not the "#images" within the page.

Finally, I have a link "#top" at the bottom of each page... takes you to http://jmscoins.com/#top.

I really can't figure this out :(

balinor 07-27-2006 10:08 AM

You need to close the <a> tag:

<a name="invest"></a>

MCM 07-27-2006 10:38 AM

Balinor,

I've now closed the tags, but the result is the same. This is also ocurring with <a href="#top"> which doesn't require a name tag.

Jeremy

balinor 07-27-2006 10:40 AM

Try putting the page url in the link:

<a href="pages.php?pageid=x#invest">

replace x with the actual page number.

MCM 07-27-2006 10:52 AM

Thanks, Balinor... that worked :)

Now, any guesses for the #top or #images problem? Since those are both in the template, it wouldn't make sense to hand-code it for every page.

I wonder if CDSEO is getting in the way somehow--I seem to recall it working before I installed that [I hadn't worked on the static pages before the installation, though]

Thanks,

Jeremy

balinor 07-27-2006 10:55 AM

Not familar with CDSEO, so can't help there :(

MCM 07-27-2006 11:59 AM

Thanks, Balinor. I'd have to guess now that it's conflicting somehow with the writing of the links from the template to the final page, so I'll see if they can help. If anyone else has any idea, though, I'd be glad to hear them!

Thanks,

Jeremy

Jon 07-27-2006 04:00 PM

Hi Jeremy,

Please see the support ticket you entered with us.

Jon Peters

MCM 07-27-2006 10:36 PM

Thanks, Jon... not only was an answer provided--but the fixes made to my website! :)

For those watching, the answer can be found in this knowledge base article. Here's the text:

Quote:

CDSEO adds a base tag to your site which means that all links will be referenced from your sites root directory. When linking to anchor tags you will need to use the pages url followed by the tag.

Invalid code:
<a href="#anchor">

Valid code:
<a href="pages.php?pageid=1#anchor">

If your using anchor tag on your product pages you can use:
<a href="{$cdseo_prod}/{$product.cdseo_url}#anchor">

To make a global anchor such as a "Back to Top" link use:
<A HREF="{$smarty.server.REQUEST_URI}#anchor">

Again, problem solved! :)[/url]


All times are GMT -8. The time now is 08:37 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.