We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34244
    • 51 Posts
    So I have a jump menu constructed from getResources that is getting an extra container inserted in the URL after a jump, so if the URL is supposed to be "updates/xxxx" it ends up being "updates/updates/xxxx". This breaks the links, so I need to eliminate that extra container from appearing. Your ideas are appreciated. Furls, Wayfinder and getResources seems to be working fine in other contexts on the site . . .

    I have the jump menu inserted directly within the page content via a chunk:

    UpdateJumpMenu:

    [[getResources? &parents=`51` &tplFirst=`JumpMenuTplFirst` &tpl=`JumpMenuTpl` &tplLast=`JumpMenuTplLast` &sortby=`pagetitle` &sortdir=`asc` &depth=`0` &option_value=`[[+uri]]` &option_label=`[[+pagetitle]]` &select_message=`Select Update . . .` ]]


    Template chunks are:

    JumpMenuTplFirst:
    <form class="page-changer" name="page-changer" action="" method="post">
        <select onChange="window.location.replace(this.options[this.selectedIndex].value)" style="margin: 10px auto;width:350px;"> 
        <option value="">[[+select_message]]</option>
        <option value="[[+option_value]]">[[+option_label]]</option>
       


    JumpMenuTpl:
    <option value="[[+option_value]]">[[+option_label]]</option>
    


    JumpMenuTplLast:
    <option value="[[+option_value]]">[[+option_label]]</option>
    </select>
    </form>
      • 39932
      • 483 Posts
      You may add a / to the beginning of your [ [+uri] ] such that it looks like this:

           &option_value=`/[[+uri]]`
      


      Alternatively, if you don't have it, you might add the Base element to your HTML Head. Make sure to set it to [ [++site_url] ]
        Website: Extended Dialog Development Blog: on Extended Dialog
        Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
        Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

        Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
        • 34244
        • 51 Posts
        Fuzzical Logic, thank you--definitely on the right track. As it turns out it was an IE-only issue and it seems that IE won't do the window.location properly from a select menu.

        What I did was more verbose (but I'm wondering if your approach wouldn't have worked more efficiently):

        <option value="[[++site_url]][[+option_value]]">[[+option_label]]</option>


        Case closed. [ed. note: aesop1 last edited this post 11 years, 8 months ago.]
          • 34244
          • 51 Posts
          Fuzzical Logic,

          I tried it your way and it worked on IE as well. We have a winner! Thanks again.
            • 39932
            • 483 Posts
            You're very welcome.

            Incidentally, if you are planning on using the whole URL every time, you might consider setting your System Setting "link_tag_scheme" to 'full'. Then you won't have to do that manually.
              Website: Extended Dialog Development Blog: on Extended Dialog
              Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
              Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

              Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
              • 34244
              • 51 Posts
              Fuzzical Logic,

              Interesting. I've wondered what the pros/cons are to using the full URL as opposed to a relative URL for internal links.

              -Matt
                • 39932
                • 483 Posts
                There is much debate on full vs abs vs relative in the web design world. And there probably always will be.

                In terms of practicality, a full or absolute URL in a non-CMS system, binds you to keeping everything where it is, limiting changes. Relative URLs allow you to move things without a lot of typing fixes.

                In a CMS system, full increases your character count and is supposedly slower. The truth of the matter is, there is no difference between a full url, absolute url or relative url. They're all dynamically generated anyway. It all comes down to what you need for your setup.

                For instance, I happen to reuse a lot of aliases, so I use a blend of relative and absolute. None is any less stable. However if a CMS implements either of these based on different standards that are nonconformant, then it forces tricksiness or demands the use of other settings or factors.

                Here are the standards in HTML:

                Relative URLs are in relation to the current path position. If your destination is the same folder, there is no prepending /. If it is in a parent folder, you must prepend with ,,/ for each parent up you must go. This is where many CMS including MODx (in some special cases) go wrong, they often only include the alias, not the necessary path navigation.

                Absolute URLs are always from the root of the site. They always should begin with a prepending slash. /joe/ is the page joe in the root. joe/ is the page joe in the current path (whereever you are). Some CMSes forget to prepend the slash, forcing you to use the base element (which is an optional element). Often, they force you to use it incorrectly (more below)

                Full URLs bind everything from the Host and automatically include the root. In a CMS, this doesn't affect anything except character output. (If you're fighting for the extra X characters because your markup is too think, then your URLs aren't the issue).

                On Base

                From W3C:

                In HTML, links and references to external images, applets, form-processing programs, style sheets, etc. are always specified by a URI. Relative URIs are resolved according to a base URI, which may come from a variety of sources. The BASE element allows authors to specify a document's base URI explicitly.

                If a URL given has a prepending slash, it is not relative, it is supposed to ignore Base. (this is where browsers argue and BASE bugs occur). Relative URLs therefore should include their path. Here's the crux. MODx doesn't know what BASE you are putting in your document. So it doesn't include proper pathing properly for Relative URLs. To compensate, it allows you to override the URIs manually. In other words, MODx only works properly with BASE when BASE is [ [++site_url] ].

                If the BASE is, say, your actual URL (which is an acceptable and taught and in many cases preferred), then all of your links are broken from MODx. You can fix this quite easily with a plugin.

                Other Notes:

                Note that makeUrl() (in Snippets) and [ [~ ] ] are not the same. makeUrl() does not use link_tag_scheme. It produces relative or full links depending on your Context and the target's Context.

                Articles also ignores link_tag_scheme, and manually overrides all URIs, and can produce links that are contrary to your Settings and BASE. This is what causes many of the bugs related to navigation with Articles itself.

                Final Notes:

                Whether you should use full, abs, or relative depends on your document structure and your use of BASE. I bypass this entirely by using absolute URLs automatically. I only use relative URLs if I manually type them in.
                  Website: Extended Dialog Development Blog: on Extended Dialog
                  Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
                  Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

                  Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".