Page 1 of 1

Problems with anchor tags on generated pages like News

Posted: Tue Jul 18, 2006 10:41 am
by Russ
There would appear to be a problem with anchor tags on generated pages like News or Album

Check out this news index page and look at the 'Top' anchor link in the footer - OK...
http://www.cms.shoesforindustry.net/cmsmodules/news/

Now click on an Article to view the atricle in detail and then look at the 'Top' anchor in the footer, which of course remains the same. This applies to the anchor tags as well. It seems to make no difference if you use 'pagealias' either...

Any ideas?

Russ

Re: Problems with anchor tags on generated pages like News

Posted: Tue Jul 18, 2006 1:01 pm
by mahjong
Use a relative URL:

Code: Select all

<a href="#content" title="Jump to top of page" class="noprint">Top</a> 

Re: Problems with anchor tags on generated pages like News

Posted: Tue Jul 18, 2006 2:48 pm
by Russ
Thanks for the suggestion mahjong, but I'm using clean url's and hence the {metadata} tag in my template, (at least I think it was to correct the image locations...) which sets a base tag. Can anyone remember if this was the sole reason for the {metadata} tag????:

Code: Select all

<base href="http://macweb/cms/" />
This puts stuff before the relative href, so even is I set:

Code: Select all

<a href="#content" title="Jump to top of page" >Top</a>
I actually get (as expected)

Code: Select all

<a href="http://www.cms.shoesforindustry.net/home/#content" title="Jump to top of page">Top</a>
I've tried removing this on my local copy, (the metadata tag), and the anchors are now OK, but the path to images fail. The one's inserted via FCKeditor?
Here is FCKeditors stuff...

Code: Select all

<a title="A Sheep" href="uploads/images/404sheep/sheep2.jpg">
<img width="96" height="64" alt="Sheep" title="Some Sheep" src="uploads/images/404sheep/thumb_sheep2.jpg" /></a>
It should be

Code: Select all

'../uploads/images/404sheep/sheep2.jpg"
  etc. surely. Now is this the only reason for the metadata tag or are there others. If it is just this then I guess we can alter FCKEditor.

When I correct the path - they show up and work on the website but not in FCKeditor... arggh...

Any other suggestions?


Russ

Re: Problems with anchor tags on generated pages like News

Posted: Tue Jul 18, 2006 3:48 pm
by Dr.CSS
i'm thinking it's from the news showing up on top of the page, sort of, and so the basic stucture hasn't changed hence it takes you back to the page you came from... if you need a top link for long articles you could put a top link in the news detail template...

Re: Problems with anchor tags on generated pages like News

Posted: Wed Jul 19, 2006 1:39 am
by Elijah Lofgren
Russ wrote: There would appear to be a problem with anchor tags on generated pages like News or Album

Check out this news index page and look at the 'Top' anchor link in the footer - OK...
http://www.cms.shoesforindustry.net/cmsmodules/news/

Now click on an Article to view the atricle in detail and then look at the 'Top' anchor in the footer, which of course remains the same. This applies to the anchor tags as well. It seems to make no difference if you use 'pagealias' either...

Any ideas?

Russ
In CMSMS 1.0-svn an "anchor" tag/plugin has been added which gives a solution to this problem introduced by using the metadata tag.

I have attached a file called "function.anchor.php.txt" which you can download, rename to "function.anchor.php" and then copy into your "plugins" folder.

Then from the help:
How do I use it?

Just insert the tag into your template/page like: {anchor anchor='here' text='Scroll Down'}
For your case you'd probably want to call it like this:

Code: Select all

{anchor anchor='content' text='Top'}
Hope this helps.  :)

[attachment deleted by admin]

Re: Problems with anchor tags on generated pages like News

Posted: Wed Jul 19, 2006 4:14 am
by Dr.CSS
does this work in 0.13-beta4 "Canary"....

Re: Problems with anchor tags on generated pages like News

Posted: Wed Jul 19, 2006 4:46 am
by Elijah Lofgren
mark wrote: does this work in 0.13-beta4 "Canary"....
I just tested it with CMSMS 0.13 and it works fine. That means it should also work with 0.13-beta4 since they likely handly plugins/tags the same way.

Re: Problems with anchor tags on generated pages like News

Posted: Wed Jul 19, 2006 10:51 am
by Russ
Thanks Elijah, save's me writing one myself ;-) Well actually I needed a few more features so attached is a revised version 1.1 which has the ability to include a class, a title and a tabindex for the anchor. (Sometimes I use it in a menu for skip to contents and skip to sub menu type of links as well as in the footer. )
Hope this helps, I've no access to SVN at work.

Just out of curiosity, why was the ordinary cms self link not altered?

Russ

[attachment deleted by admin]

Re: Problems with anchor tags on generated pages like News

Posted: Wed Jul 19, 2006 4:11 pm
by westis
Russ,

Your amendments are added to svn. Thanks!

And as for the exercise Calguy gave me, glad you did that before me. ;) Too much to do with finishing up the new default templates for 1.0 anyway... ;D