Problems with anchor tags on generated pages like News

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm
Location: North West England

Problems with anchor tags on generated pages like News

Post 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
mahjong

Re: Problems with anchor tags on generated pages like News

Post by mahjong »

Use a relative URL:

Code: Select all

<a href="#content" title="Jump to top of page" class="noprint">Top</a> 
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm
Location: North West England

Re: Problems with anchor tags on generated pages like News

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Problems with anchor tags on generated pages like News

Post 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...
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am
Location: Deatsville, AL

Re: Problems with anchor tags on generated pages like News

Post 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]
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Problems with anchor tags on generated pages like News

Post by Dr.CSS »

does this work in 0.13-beta4 "Canary"....
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am
Location: Deatsville, AL

Re: Problems with anchor tags on generated pages like News

Post 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.
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm
Location: North West England

Re: Problems with anchor tags on generated pages like News

Post 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]
westis

Re: Problems with anchor tags on generated pages like News

Post 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
Post Reply

Return to “Developers Discussion”