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

    I’ve got intro trouble with DropMenu using SEO friendly alias paths (both enabled: aliases and alias paths).

    Problem:

    topic1
    topic2/
    topic2/sub

    If I’m navigating into topic2, then because of DropMenu spitting out relative links, my navigation shows topic2/topic1 for the topic1, which is wrong, because topic1 is also a root topic.

    I searched the forum and the problem is well known. There also exists a fix: Simply putting <base href="[(site_url)]" /> into the document head. But I didn’t like this one, particularly as this triggers another side effect with "#" links.

    I did some small fix (which is a hack and completely unsupported!) presented as a standard unified diff:

    --- document.parser.class.inc-ORIG.php	Wed Apr 26 21:26:02 2006
    +++ document.parser.class.inc.php	Thu Jul 13 23:44:06 2006
    @@ -801,5 +801,5 @@
       function makeFriendlyURL($pre,$suff,$alias) {
         $dir = dirname($alias);
    -    return ($dir!='.' ? "$dir/":"").$pre.basename($alias).$suff;
    +    return $pre.($dir!='.' ? "$dir/":"").basename($alias).$suff; // SEO friendly "alias path" FIX: we use the prefix as a base dir prefix
       }
    


    It simply puts the system configuration option "Prefix for friendly URLs" in front of the complete URL, so if I set this option to "/" (without the double quotes), it simply puts all URLs absolute to the site domain. As I already said, this is a hack - IMHO it would be best, if there exists another global option for this purpose.

    I’d like to know from the experts if this has any side-effects, maybe with existing major plugins.

    You’ve be warned: This is a (possibly bad) HACK - I’m IN NO WAY an expert with MODx!

    Greetings,

    Alex
      • 29988
      • 89 Posts
      About a week ago, I’ve made a SVN commit, that adds a home-url location into server settings, so this gives an oportunity for dropmenu to convert all links to exact ones very easily in next version and this problem will be solved.
        • 113
        • 5 Posts
        Thanks for your reply. This is great news!

        Is it possible to get read-only SVN access or is this a closed repository for the MODx Team only?
          • 25663 MODX Staff
          • 12,272 Posts
          SVN is currently for the team but we’ll be moving forward with a more open environment in the near future.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: tillda at Jul 13, 2006, 11:34 PM

            About a week ago, I’ve made a SVN commit, that adds a home-url location into server settings, so this gives an oportunity for dropmenu to convert all links to exact ones very easily in next version and this problem will be solved.

            I’m not sure I understand tillda. site_url already has this home-url location in system settings...
              • 29988
              • 89 Posts
              Quote from: OpenGeek at Jul 14, 2006, 06:57 PM

              I’m not sure I understand tillda. site_url already has this home-url location in system settings...

              I don’t have this in my db/checkout.... where does this came from?
                • 22303 MODX Staff
                • 10,725 Posts
                It’s not in the db, it’s dynamically set in config.inc.php on each request...and then added to the rest of the settings when the MODx class is constructed.
                  • 22815
                  • 1,097 Posts
                  site_url is clever, but doesn’t solve the problem -
                  mysite.com/directory/page.html needs to know that mysite.com is the home and not mysite.com/directory.

                  More to the point, you sometimes need to know that mysite.com/directory is the home and not mysite.com/directory/directory.

                  Not everyone needs home-url, but it is nice to have the option.

                    No, I don&#39;t know what OpenGeek&#39;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!
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: PaulGregory at Jul 19, 2006, 09:50 AM

                    site_url is clever, but doesn’t solve the problem -
                    mysite.com/directory/page.html needs to know that mysite.com is the home and not mysite.com/directory.

                    More to the point, you sometimes need to know that mysite.com/directory is the home and not mysite.com/directory/directory.

                    Not everyone needs home-url, but it is nice to have the option.

                    But that’s just it, mysite.com/subdir is never the home directory! All requests are working from the same location, the root of the site, at all times, even with friendly alias paths enabled. I don’t see any purpose for home-url, sorry if I’m missing the issue. Perhaps $modx->virtualDir is what you are looking for?
                      • 22815
                      • 1,097 Posts
                      I’m possibly wrong on this, as it is something I tried early on before I got to know MODx properly and I misunderstood what you were saying before.
                        No, I don&#39;t know what OpenGeek&#39;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!