We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32494
    • 14 Posts
    I’m struggling to open an external page within MODx. So far, I could get it to run in an Iframe using the TV View Port, but I know some people don’t like this method. What is the best option? Is Iframe OK?

    I’ve also tried to use include virtual statement but then have a problem with links not opening in ModX if it’s another forlder than the root, etc. Any way somebody can help. I’ve searched the forum but no post really helped me.

    Help appreciated!
      • 16034
      • 107 Posts
      I think the best solution depends a lot on what kind of document you are including.

      So maybe you could tell a bit more about what it is, and why it should be included in the page?
        MODx snippet-glossary 101:
        Ditto = Content Lister -- Wayfinder == Menu Builder -- Jot = Comment Control
        • 32494
        • 14 Posts
        Documents will differ from time to time, but at this stage the most important are php files running a database development that is in a different folder.
        It might also be a database folder from time to time running on another domain.

        The include statement opens the database, but the css files from MODx and the databse seem to clash with eachother. Also, clicking on links, opens the next page outside of MODx template.

        The Iframe works fine, but I know some browsers don’t support it. Is there real issues using the Iframes?
          • 3749
          • 24,544 Posts
          If the pages being pulled in end up going through the MODx parser, any PHP code will be stripped out (all PHP code in MODx has to be in a snippet).

          You could probably write a snippet that would get the content of the other pages and return it to MODx.
            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
            • 32494
            • 14 Posts
            Anyone with suggestions how to do this?
              • 7231
              • 4,205 Posts
              I have done this for a client. I used php’s file() function to read the document then set it to ignore everything outside the <body> tags. Works great. The php is parsed before going into MODx so there is no problem with the php being stripped. Then used some eregi_replace() calls to modify any styling that was needed to match the styles on the current site.

              Please only use this with the permission of the page being included...not to ’borrow’ content from other sites  wink

              You can see it in action here:
              http://bit.ly/4Xs5E -> and the original page is here -> http://bit.ly/4Nycs
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don&#39;t know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 32494
                • 14 Posts
                Can you please provide some code for how to achieve this. Can’t seem to get this right.