Topic: 'back to top' links  (Read 1325 times)

Pages: [1]   Go Down

#1: 29-Aug-2006, 10:09 AM


arphaus
Posts: 134

pizza!

WWW
as i just found out, making a 'back to top link' that goes to an anchor at the top of the page results in it going to the anchor on whatever is the site start page.  ok, so i'd have to make it a variable for each page, and that works, but each page gets totally reloaded, resulting in a brief wait.  the wait kinda defeats the purpose of a quick 'click this link to go back to nav instantaneously' thingy.  i assume then that this is a limitation of working with a cms, but i'm just checking to see if there's any workaround.

my solution is to just have the actual menu links so people can skip to another section rather than a back to menu that reloads the page in order for peeps to skip to another section.
Sorry - not using ModX anymore 01/01/2007

#2: 29-Aug-2006, 10:16 AM

PaulGregory
MODx's midnight runner
Posts: 1,097

MODx's midnight runner

WWW
If your pages are long, having menu links at both ends is usually good.

But I think your issue is either due to you not using Friendly URLs, or to the presence of a base href in the template.
No, I don't know what OpenGeek's saying half the time either.
MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
Forum: Where to post threads about add-ons | Forum Rules
Like MODx? donate (and/or share your resources)
Like me? See my Amazon wishlist
MODx "Most Promising CMS" - so appropriate!

#3: 29-Aug-2006, 11:35 AM

Foundation

OpenGeek
MODx Co-Founder
Posts: 6,720

damn accurate caricatures...

WWW
This should work fine if you create those links like this:

Code:
<a href="[~[*id*]~]#anchorName" title="anchorName">Go to anchorName</a>

...

<a name="#anchorName"></a>

If you try to create them without the URL generated by [~[*id*]~], i.e. href="#anchorName", that is going to always go back to the root of the site.
Jason Coward
MODx Co-Founder
xPDO Founder
CTO @ Collabpad
work productively.
work intelligently.
work together.
Light is just a vibration of a note too. Everything is. You've got to keep that in mind.
  Frank Zappa

#4: 29-Aug-2006, 11:39 AM


kudolink
Posts: 241

MODx Entusiast!

WWW
This should work fine if you create those links like this:

Code:
<a href="[~[*id*]~]#anchorName" title="anchorName">Go to anchorName</a>

...

<a name="#anchorName"></a>

If you try to create them without the URL generated by [~[*id*]~], i.e. href="#anchorName", that is going to always go back to the root of the site.
Mmm... are you sure?
I've no problem at all setting anchors like
Code:
<a href="#top" title="Go to the top">Go to the top</a>
...
<a name="#top"></a>

@arphaus
Perhaps you've set the base-url in your template?
kudo
www.kudolink.com - webdesign (surprised?)

  proudly uses 

#5: 2-Sep-2006, 06:09 PM

Guest
@arphaus:

If your <base href="[(site_url)]" /> is set then use the following snippet call.

Code:
// ###########################################
// TopofPage                                 #
// ###########################################
// produces a link back to the top of the page
//
// ###########################################
// Implementation                            #
// ###########################################
// [!TopofPage!]
//
// Adjust "$output" for your needs
//
//
//

$toplink = $modx->makeUrl($modx->documentIdentifier);
$toplink .="#top";
$output ="<a href='$toplink' title='Jump to the top of the page'>Top of Page</a>";

return $output;

To see it working http://www.polo-pasion.co.uk

Hope it helps
Pages: [1]   Go Up
0 Members and 1 Guest are viewing this topic.