1 jinbrother1 Sep 06, 2005 02:37
3 jinbrother1 Sep 06, 2005 06:23
I tried your suggestion, but when I click on the link, I'm directed to a directory page titled "Index of /blog/skins/MT_dot_org" listing all the pages and images in that root. But thanks for sharing your thought.
4 edb Sep 06, 2005 06:42
The problem is because "<a href="#top">Jump to top</a>" is a relative link and b2evolution uses the base tag for skin-related stuff. To make it work you would have to come up with the complete url of the page the visitor is on. It could be your blog's main page, but it could also be the second or third (or more!) page of multiple posts.
Unfortunately I don't have a solution. Hopefully someone will come along and say how easy it is to make it be "<a href="THE_URL_OF_THE_CURRENT_PAGE#top">Jump to top</a>".
BTW I'm moving this to the "Request a Plugin or Hack" forum because that's what this is.
EDIT: It would make a nice hack. I hope someone figures it out, and posts the solution in the plugins and hacks forum
5 the_engineer Sep 06, 2005 16:24
This works with mine
File name: /skins/skinname/_main.php
Put this where you want the jump to go to:
<a name="top"/>
Put this where you want the jump link:
<?php
$url = sprintf("%s%s%s","http://",$HTTP_HOST,$REQUEST_URI);
?>
<a href="<?php echo $url ?>#top">Jump to top</a>
Thats all there should be to it
Jon
6 jinbrother1 Sep 06, 2005 17:51
Works like a charm! :D Thanks Jon!
7 the_engineer Sep 06, 2005 18:14
jinbrother1 wrote:
Works like a charm! :D Thanks Jon!
Glad to hear it.
Jon
8 john Sep 06, 2005 18:14
Thank you :) , sure beats using
<a href="<?php echo regenerate_url() ?>#top" title="goto page top">top</a>
9 edb Sep 06, 2005 19:28
[url=http://forums.b2evolution.net/viewtopic.php?t=5342]I copied both solutions to the plugins and hacks forum.[/url]
10 personman Sep 06, 2005 20:21
Both of these solutions look great. Can anyone explain to me why one would be better than the other?
11 the_engineer Sep 06, 2005 22:57
personman wrote:
Both of these solutions look great. Can anyone explain to me why one would be better than the other?
On my Blog this code:
<?php $jumpurl = sprintf("%s%s%s","http://",$HTTP_HOST,$REQUEST_URI);?>
Produces this for the URL:
http://projects.urjb.com/index.php/Lego/2005/08/21/harddrive_case#top
This code:
<a href="<?php echo regenerate_url() ?>#top" title="goto page top">top</a>
Produces a URL of :
http://projects.urjb.com/index.php/Lego/2005/08/21/harddrive_case?blog=3&c=1&page=1&more=1&title=harddrive_case&tb=1&pb=1&disp=single#top
For me, I like the cleaner looking URL.
Also the regenerate sends a query to the server when you click the link, where as the $var does not. At least on the browsers I checked it with FF and IE
Just my 38 cents Gas prices went up :p
Jon
12 personman Sep 06, 2005 23:00
I see. That is better. Thanks for explaining it.
13 the_engineer Sep 06, 2005 23:46
If you want to save a CPU cycle or 2
push it back on the client with Javascript
<script language="JavaScript" type="text/javascript">
<!--
document.write("<a href= \"" + document.location + "#top\">Jump Up</a>");
// -->
</script>
But that would be so 1999 ;)
Jon
14 the_engineer Sep 07, 2005 01:50
I guess it should be noted that
this function
sprintf("%s%s%s","http://",$HTTP_HOST,$REQUEST_URI)
pulls what is shown in the browsers address bar.
and this
regenerate_url()
Generates the full [u]URI[/u] of the page.
So the bottom line is, if the Use extra-path info: checkbox in the back office is not checked, they will both act the same.
Or you could always just use the scrollbar :>
Jon
I would think you could add this into a skin pretty easily. Just edit _main.php and add this right after the <body> tag:
Then, wherever you want it to appear, put:
The most natural place to put it would be right before or after the comment link and date that follow each post. You could put it at the very bottom of the page, too. I haven't tested this, but I don't know why it wouldn't work.