We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39498
    • 169 Posts
    I have a resource, that is additionaly rendered by a plugin snippet with renderResources to use its output somewhere else. But the renderResources output differs to the resources output. All links have double site url in the output by renderResources. The Chunks have a [[++site_url]]. The resource renders well, the snippet renders as if [[++site_url]][[++site_url]].
      • 3749
      • 24,544 Posts
      If you have this in the head of your templates,

      <base href="[[++site_url]]" />


      MODX will prepend the site url to any href. That may be what's happening. You could try it without any ++site_url tags and see if the links work.

      Can you give some examples of the ++site_url tags in your chunks?
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 39498
        • 169 Posts
        checked that already. I dont have any base in the template defined.

        I have a chunk with
        <h4><a href="[[++site_url]][[~[[+id]]]]" title="[[+pagetitle]]">more…</a></h4>

        This gets rendered in a page an turns out well.
        When rendered like so
        		$output .= $modx->runSnippet('renderResources',array(
           'parents' => 1905,
        			'resources' => 1902
        		));

        the [[++site_url]] get doubled. Template should be defined by the page 1902 already, or explicitely in the script?
          • 3749
          • 24,544 Posts
          The proper solution is to use this tag in the head section of all your templates and remove all the ++site_url tags:

          <base href="[[++site_url]]" />


          If you have more then one front-end context, it should be:

          <base href="[[!++site_url]]" />


          If that doesn't give you full URLs and you want them, you can do this:

          [[~[[+id]]? &scheme=`full`]]
          [ed. note: BobRay last edited this post 10 years, 9 months ago.]
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 39498
            • 169 Posts
            Well,
            [[~[[+id]]? &scheme="full"]]
            with <base href="[[!++site_url]]" /> gives no full url output. Maybee because the html is rendered for a newsletter with css_to_inline_styles?

            href="[[++site_url]][[~[[+id]]]]"
            only gives a full url in the resource. But why is the output rendered differently in the script?

            I have no explanation for that. Maybe I just do a search and replace on the doubled site_url.
              • 3749
              • 24,544 Posts
              Oops. Try this:

              [[~[[+id]]? &scheme=`full`]]


              I was thinking of $modx-makeUrl() in a custom snippet, in which case it's:
              $modx-makeUrl($id, "", "", "full");

                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 39498
                • 169 Posts
                Yes, already tried
                [[~[[+id]]? &scheme=`full`]]
                without change.

                Think I ll try the snippet or regex.