We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16845
    • 26 Posts
    Hi there,

    First of all thank you so much for MODx. In the process of building my first CMS powered site and it’s a joy to use.

    Please forgive me if this has been addressed before. I have searched to no avail.

    I have a number of jQuery plugins on the site (notably the Coda Slider) and most of them generate #examplelink anchors for their functionality.
    What’s happening in MODx is that instead of becoming "Go to #examplelink on this page" links, there are being parsed as "baseurl/#examplelink"

    You can see what I mean here: http://203.88.117.97/~nativeto/index.php?id=20

    The panels have buttons (Introduction, Biography, Video). usuallyt pressing the button just takes you to the next panel.
    In MODx, it’s taking me to the home page (which incidentally also has panels).
    (Very unfinished page btw!)

    It’s probably a very easy fix, although i don’t yet know PHP so hopefully no custom coding.

    Many thanks in advance for your help.


      • 4310
      • 2,310 Posts
      There is a plug-in to help:
      // BaseURL Same-Page-Link Fix
      // Version: 1.0
      // Author: Paul Bohman
      // Last updated: April 17, 2008
      // Note: For the sake of consolidation and simplicity (and perhaps a slight improvement in performance),
      // this plugin could be combined with any other plugin that uses the OnWebPagePrerender trigger,
      // such as the Page TOC Generator
      
      // get the whole page, right before it's rendered to the browser
      $source = &$modx->documentOutput;
      
      // syntax to check
      $doubleQuote = 'href="#';
      
      // uncomment these lines if you want to check for single quotes or no quotes:
      // $singleQuote = "href='#";
      // $noQuote = 'href=#';
      
      // here the link is replaced with the full path, plus the anchor reference:
      $source = str_replace($doubleQuote, 'href="'.$_SERVER["REQUEST_URI"].'#', $source);
      
      // uncomment these lines if you want to check for single quotes or no quotes:
      //$source = str_replace($singleQuote, "href='".$_SERVER["REQUEST_URI"].'#', $source);
      //$source = str_replace($noQuote, 'href='.$_SERVER["REQUEST_URI"].'#', $source);

      Create a new plug in with the above code, then on the "System Events" tab check "OnWebPagePrerender"
      That should do it.
        • 16845
        • 26 Posts
        Thank you very much for the quick answer. I’m about to try it out now!