Welcome Guest, Not a member yet? Register   Sign In
page anchors
#1

[eluser]darkhouse[/eluser]
I've searched the forums, but can't find too much... I've got a simple CMS in the works, and I'm trying to use a Back To Top link throughout my content
Code:
<a href="#top">Back To Top</a>

When it's clicked, it doesn't just put #top at the end of the current url like domain.com/controller/method#top instead it loads the homepage. This is because of the base tag which is necessary to load everything properly... if the href includes the current uri like
Code:
<a href="URI_STRING#top">Back To Top</a>
//had trouble getting the $this->uri->uri_string() function to show up in the link here,
//but you get the idea...
it works fine... but again, I'm creating this content through a CMS, and ultimately it will be the client managing this content.

I have 2 possible solutions to this problem. I can either use jQuery or preg_replace to prepend any links that have a # with the current uri string. Does anybody else have any ideas?

Thanks.

Edit: I decided to do the preg_replace method, and it works fine, but if anyone has any other ideas, or even ideas why the preg_replace method might not work, please let me know. Thanks.


Messages In This Thread
page anchors - by El Forum - 01-18-2010, 02:38 PM
page anchors - by El Forum - 01-18-2010, 04:29 PM
page anchors - by El Forum - 01-18-2010, 04:33 PM
page anchors - by El Forum - 01-18-2010, 08:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB