We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    Also, if you want to build them using the alias instead of the id, you can take a look at my AliasLinks plugin at http://modxcms.com/forums/index.php/topic,2763.0.html -- you could use those in conjunction with #anchor links as well, like so:
    [~[+alias:somepagealias+]~]#anchor

    This might be useful for creating portable content dependent on aliases instead of document ids.
    And FYI, [*alias*] only gets the current document’s actual alias, not the full alias path as is applied via the [~~] tags, but this may be possible with the plugin, though I haven’t tried it:
    [~[+alias:[*alias*]+]~]#anchor


    Just some other options I wanted to point out.
      • 32241
      • 1,495 Posts
      I add your comment to the original topic, so it will be like a reference for people who startes using your plugin.

      Sincerely,
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 12110
        • 122 Posts
        Hello,

        iI just discovered this thread and was very glad to find a solution to the top of page link with dynamic path.

        Just want to add a chunk here that uses this and also uses some javascript (originally found elsewhere and adopted) to show the top of page link only if the page is long enough to make sense for a top link:

        <script language="JavaScript" type="text/JavaScript">
        <!-- inner height -->
        var a,b;
        if (self.innerHeight) // all except Explorer
        {
        	a = self.innerWidth;
        	b = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        	// Explorer 6 Strict Mode
        {
        	a = document.documentElement.clientWidth;
        	b = document.documentElement.clientHeight;
        }
        else if (document.body) // other Explorers
        {
        	a = document.body.clientWidth;
        	b = document.body.clientHeight;
        }
        <!-- page height -->
        var x,y;
        var test1 = document.body.scrollHeight;
        var test2 = document.body.offsetHeight;
        if (test1 > test2) // all but Explorer Mac
        {
        	x = document.body.scrollWidth;
        	y = document.body.scrollHeight;
        }
        else // Explorer Mac;
             //would also work in Explorer 6 Strict, Mozilla and Safari
        {
        	x = document.body.offsetWidth;
        	y = document.body.offsetHeight;
        }
        
        if (b+50 < y) {
        document.write("<a href=\"[~[*id*]~]#welcome\">top of page</a>")};
              </script>
          <noscript>
          <a href="[~[*id*]~]#welcome">top</a>
          </noscript>
        


        I put this chunk into my templates and it works. I have SEF urls and alias urls and alias paths active. You may want to adjust the line with (b+50 <y) to your needs. It says the top link is shown when the page height y (page content) is greater than the visible browser window height + 50 pixels.

        This works in IE 6 and IE7 (it should work in Firefox, but there seems to be a problem right now).

        Maybe this helps someone smiley

        Best regards Guenter
          • 6726
          • 7,075 Posts
          Thanks very much for sharing : this is sure an improvement - you even thought to make it degrade gracefully - I’ll try it out smiley !

            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id
            • 43165
            • 13 Posts
            Quote from: wendy at Feb 27, 2006, 07:25 PM
            index.php?id=2#anchorlink (will this work?).

            don't work/