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

    I have inherited a site that is setup in Modx and the owner ask me to do something that I can’t find a solution for. There is a page that currently has an href on it. Instead of a link to a url, he would like the contents of that url to appear in place of the href. So I think what he’s asking for is an include using a url instead of a path. An example would be:

    Currently html:
    <a href="http://www.google.com">Click here for Google</a>

    What he wants is the google page contents in place of the href.

    Is this possible? I haven’t found anything yet but then I’m really new to Modx.

    Thanks!
      • 16183
      • 1,390 Posts
      joeco,

      I don’t quite get the logic. If it is to be clicked, then it has to be a href, no? If that document is a modx document then you can use the modx tag for internal links which is [~id~] where id is the id of the modx document you want to link to.

      On the other hand, if he wants to display the contents of another modx document within another document, then there’s a snippet called getField that can do this and much more. You can find it here:

      http://modxcms.com/forums/index.php/topic,5643.0.html - the support forum
      http://modxcms.com/extras/package/?package=173 - the download (it works fine despite the beta tag wink )

      Hope this helps. Welcome to modx!

      cheers/k
        • 9130
        • 171 Posts
        The simple solution would be to use an iframe.

        The other option is to build a snippet that read the contents of the external page but it would probably need additional processing to integrate it with you own page, it would be much better if the other page had an RSS feed or an API that you can access.
          • 30223
          • 1,010 Posts
          It looks like he just wants a google search box on the page judging from the original link. There’s several ways to achieve that. Here’s a few links, but make sure you check the legalities of using these...
          Have a look at
            • 14401
            • 4 Posts
            Thanks for the replies everyone!

            The website owner doesn’t want a link and I was just using google.com as an example. He wants the contents of another url (not a modx page) to display on the page. Here’s the url that I have to work with:
            http://www.aldrichstamps.com/modx921/index.php?id=17

            There is a link on that page that says, "CLICK HERE TO SEE OUR CURRENT SALE LISTINGS". He doesn’t want the link. He wants the contents of that page to replace the link. I have done something similar with a function I wrote for a Foxweb based site but I’m not sure how to make it work in Modx.

            Thanks again!
              • 9130
              • 171 Posts
              As I already said the simple solution is an iframe, modx doesn’t need to be involved.
                • 18374
                • 69 Posts
                etal is correct - you will want to display the external page within an iframe. This element is handled the same way regardless of platform (MODx or otherwise).

                More information and a demo available here: http://www.w3schools.com/TAGS/tag_iframe.asp
                  • 14401
                  • 4 Posts
                  Iframes I can do. I guess I was making more difficult than it really was. I was thinking I had to do something special since it’s Modx.

                  Thanks!
                    • 1343 ☆ A M B ☆
                    • 2,213 Posts
                    Why would you need to do something special with MODx? After all you don’t apply your site to MODx, you apply MODx to your site.

                    Normal HTML works just fine regardless of MODx.
                      Patrick | Server Wrangler
                      About Me: Website | Tweets |  MODX Hosting
                      • 14401
                      • 4 Posts
                      My Modx experience has been about 2 hours so I wasn’t sure. I think I got it from here.

                      Thanks