We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    Hello everyone.

    Im new to MODx and have stumbled on a problem.

    Im trying to link to an ID within a page, but due to the <base href="[(site_url)]" /> it sends me to my index page.
    eg. mydomain.xxx/#top instead of the page im on and then #top

    Is there a snippet out there that can help?

    Or has anyone had this problem before and solved it.

    Appreciate the help, many thanx.
      • 18397
      • 3,250 Posts
      Try this for the href of your a tag:

      [(site_url)][~[*id*]~]#top
        • 34162
        • 1 Posts
        Ive already tried that, thanx.

        The tag needs to be in the template, therefore this method sadly doesnt work.

        Is there no snippet out there?

        Here in this forum is a link "Go Up", what I need is similiar
          • 4041
          • 788 Posts
          heres a little snippet I use:

          [[toplink]]

          /* toplink
             produces a link back to the top of the page
          */
          $toplink = $modx->makeUrl($modx->documentIdentifier);
          $toplink .="#top"; 
          $output ="<div align='right'><a href='$toplink' class='toplink' title='Jump to the top of the page'>Back to Top <img src='assets/templates/default/images/backtotop.gif' border='0' alt='Jump to the top of the page' /></a></div>";
          
          return $output;


          change the last $output to format the link the way you want...
            xforum
            http://frsbuilders.net (under construction) forum for evolution
            • 34162
            • 1 Posts
            @Breezer, thats excellent, thanx for your help.

            Much appreciated