We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1764
    • 680 Posts
    Okay, so I’ve been working on combining snippts, chunks, and plugins into widgets and I have an idea. The whole executable checkbox has never set right with me, it just seems too limited. So then I get the idea to have the option to select your language instead of a simple executable or not. So we could have HTML or PHP. Then I think why not have Javascript and CSS, these could atumatically insert themselves into the <head>. So then I think why not have Perl, Java, Python, Bash, Ruby, whatever "pseudo-compilers." They wouldn’t have the advantage of the API but you should be able to pass them the variables form the snippet call and get their output.

    With the CSS and Javascript compilers there would be no need to actually include them in the document since they’d automatically find their way into the <head> anyway. So you could easily create a TV that would pull in a list of all of the CSS and JS widgets and just rundown the list of what you want included in the page (Tables CSS, Forms CSS, PNG support, Google Analytics, etc.).

    So what do you think? Initially we wouldn’t need to do anything more than PHP and HTML and then we could always expand it out to whatever else we can think up. The "compilers" could just be files in a directory that you could drop in place and start using.
      • 25663 MODX Staff
      • 12,272 Posts
      That’s really interesting. Victor would LOVE to toss some perl into the mix, and this would be a great, elegant way to do that! Man, is it idea day or what!?!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 32963
        • 1,732 Posts
        This sounds great Adam.

        I like the idea of CSS and JavaScript but I’m not sure how we can handle Perl, etc. Can Perl run via PHP?

        The other thing is that the JavaScript/CSS widgets are technically speaking HTML snippets. So in some way The user will be required to add these to the page

        [[HomePageJavaScript]]
        [[HomePageStyleSheet]]

        The reason is that at times users might want a certain script to be loaded after certain section of the page:

        <some html here id="t1">
        [[MyScript]]
        <some html here id="t2">
        [[MyScript2]]

        In the above MyScript2 is designed to work on the t2 element

        CSS widgets can be processed and added to the <head> tag but I think those should be displayed where they are






          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
          • 1764
          • 680 Posts
          Quote from: xwisdom at Nov 23, 2005, 01:53 PM

          I like the idea of CSS and JavaScript but I’m not sure how we can handle Perl, etc. Can Perl run via PHP?

          I know that this is possible but I’m not sure how simple it will be. You’d basically have to run it via a command line and get the output or maybe create a temporary file. I’m not 100% sure. But I know that PHP has no problem doing /usr/bin/php -r "echo(’hello world’);" and I’m sure Perl can do the same.

          Quote from: xwisdom at Nov 23, 2005, 01:53 PM

          The other thing is that the JavaScript/CSS widgets are technically speaking HTML snippets. So in some way The user will be required to add these to the page

          [[HomePageJavaScript]]
          [[HomePageStyleSheet]]

          Right, but these could be handled fairly transparently via a TV or even a plugin so that it wouldn’t have to clog up your actual content or require individual TVs for the header.

          Quote from: xwisdom at Nov 23, 2005, 01:53 PM

          The reason is that at times users might want a certain script to be loaded after certain section of the page:

          <some html here id="t1">
          [[MyScript]]
          <some html here id="t2">
          [[MyScript2]]

          My thought was that in the cases where you would need javascript in the body it would basically be an HTML widget instead of a javascript widegt. You could also have two "compilers" if you wanted like javascript-functions and javascript-inline or even try to figure out where it goes based on the existance of a <script> tag.

          Any of these things can be hashed out later and because the system is so modular it will be easy to include whatever we want down the road.

          I might also mention that we could easily do things like BBcode and other similar formatting code. It is also possible that this could handle compiled PHP code like from Zend (I’m not sure how exactly that all works though). The possibilites are really endless, we could render binary formats like images or pdfs (might have to change the database for that). We could have a Word cleanup or Tidy compiler that you could dump messy HTML into and get clean output. We could even write our own "language," for instance maybe we should have a compiler that would turn MODx style lists (item1==Item 1||item2==Item 2) into html lists.