We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39251
    • 53 Posts
    I already found a thread answering "no" to this question, but it was four years ago, so I'm wondering (hoping?) if things have changed.

    I have a site with hundreds of static HTML pages, coded by many different people (so nothing is standard), that I'll be slowly importing into MODx. These pages are full of SSI includes and echo statements such as <!--#include file="includes/top.htm" -->.

    Obviously ultimately I'll be using chunks and snippets, but for right now, is there any way to get MODx to process these includes?
      If there's a better way to do it, I'll find it.
      • 3749
      • 24,544 Posts
      You need to surround your code with code tags in forum messages so we can see it. smiley

      I don't think it's likely that what you're suggesting will ever be possible in MODX. The security advantages of never executing PHP code in a page are too important to mess with.

      I won't lecture you on the many advantages of converting mixed PHP and HTML code to snippets and Tpl chunks. wink



      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        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
        • 39251
        • 53 Posts
        Oh, sorry. I knew that about code tags, I'm just having an off day. Well, all you missed was a standard example of an include file.

        Believe me, no lecture needed. I've been using Revo since it came out and very hesitantly call myself a near-expert. ;-) I'm just staring at hundreds of pages of badly-coded HTML hoping for some kind of break... (The way some of these are coded, even simple searches and replaces of identical code can break things. It's actually impressively awful.)

        BTW, I see you're "that" Bob. Nice to meet you. I've been referencing your guides forever!
          If there's a better way to do it, I'll find it.
          • 3749
          • 24,544 Posts
          Thanks for the kind words. I thought about suggesting creating some kind of tool to abstract the includes with a regular expression search, but if the code is truly awful, it probably wouldn't work.

          It's theoretically possible to write a parser that would replace the code with a zillion placeholders and move it into a zillion tiny snippets, but I think then the code would go from bad to worse. wink



          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            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
            • 39251
            • 53 Posts
            What I'm doing for now is just having an include file include a php file that includes MODx functionality so I can at least access the FormIt add-on. At least THAT part was coded sanely enough that I can fix this first issue by just changing the include file. (To include a file that includes a file that includes... just kill me.)

            Off topic, but sometime I should show you what I did to Newspublisher to create an in-line editor that includes a front-end control for picking an image from a Gallery album. I suspect both you and splittingred will either be impressed or ban me from ever touching MODx again. ;-)

            What's the appropriate topic line change here? [AS SOLVED AS IT EVER WILL BE]?
              If there's a better way to do it, I'll find it.
              • 3749
              • 24,544 Posts
              If you forked the NewsPublisher repo (preferably the current version) at GitHub, you could just push your changes to your fork and send me a note. That way I could look them over (just don't hold your breath -- I'm swamped).



              ------------------------------------------------------------------------------------------
              PLEASE, PLEASE specify the version of MODX you are using.
              MODX info for everyone: http://bobsguides.com/modx.html


                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
                • 39251
                • 53 Posts
                The biggest change I did to NP was to add support for a couple of custom TV types including the image select component. I suspect splittingred could show me a MUCH easier way to have done that front-end component, but I know you're both swamped.

                As am I, really. I hate to admit it, but somewhere way down "My List" is "figure out how to use GitHub." I've actually done some really cool MODx components, but have this bit of paranoia about letting you true experts see exactly how I managed it. ;-) But I do plan one day when I have some "copious free time" to actually submit some of these.
                  If there's a better way to do it, I'll find it.
                  • 3749
                  • 24,544 Posts
                  There's a new version of NP, coming out "real soon now" that does some of that. It's up at GitHub now.

                  For your extras, take a look at the GetMyComponent/MyComponent package and its tutorial (http://bobsguides.com/mycomponent-tutorial.html). It basically walks you through creating an extra, and the package has examples of how to code almost every kind of object.

                  Once you learn to use it, it will save you a lot of time, too.

                  I'm sure everyone would appreciate having access to your add-on components in the repository (and, BTW, you can do it without using Git or GitHub at all, thought they are handy tools).


                  ------------------------------------------------------------------------------------------
                  PLEASE, PLEASE specify the version of MODX you are using.
                  MODX info for everyone: http://bobsguides.com/modx.html
                    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