Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

HTML Anchors not working on static pages

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-27-2006, 09:54 AM
 
MCM MCM is offline
 

Senior Member
  
Join Date: Dec 2005
Posts: 114
 

Default 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
__________________
Version 4.0.17/4.0.18
Reply With Quote
  #2  
Old 07-27-2006, 10:01 AM
 
MCM MCM is offline
 

Senior Member
  
Join Date: Dec 2005
Posts: 114
 

Default

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
__________________
Version 4.0.17/4.0.18
Reply With Quote
  #3  
Old 07-27-2006, 10:08 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

You need to close the <a> tag:

<a name="invest"></a>
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #4  
Old 07-27-2006, 10:38 AM
 
MCM MCM is offline
 

Senior Member
  
Join Date: Dec 2005
Posts: 114
 

Default

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
__________________
Version 4.0.17/4.0.18
Reply With Quote
  #5  
Old 07-27-2006, 10:40 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Try putting the page url in the link:

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

replace x with the actual page number.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #6  
Old 07-27-2006, 10:52 AM
 
MCM MCM is offline
 

Senior Member
  
Join Date: Dec 2005
Posts: 114
 

Default

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
__________________
Version 4.0.17/4.0.18
Reply With Quote
  #7  
Old 07-27-2006, 10:55 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Not familar with CDSEO, so can't help there
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #8  
Old 07-27-2006, 11:59 AM
 
MCM MCM is offline
 

Senior Member
  
Join Date: Dec 2005
Posts: 114
 

Default

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
__________________
Version 4.0.17/4.0.18
Reply With Quote
  #9  
Old 07-27-2006, 04:00 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

Hi Jeremy,

Please see the support ticket you entered with us.

Jon Peters
Reply With Quote
  #10  
Old 07-27-2006, 10:36 PM
 
MCM MCM is offline
 

Senior Member
  
Join Date: Dec 2005
Posts: 114
 

Default

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]
__________________
Version 4.0.17/4.0.18
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:49 PM.

   

 
X-Cart forums © 2001-2020