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

    Im a brand new modx user trying to explor all the usefull tools and functions.
    But right now Im stuck with the following ’problem’:

    AFAIK you can only put php code in snippets - but is it possible (anyhow) to put php in the content textfield or in a template variable? So far I couldnt get it done? - I know you can put snippets in TVs, but thats somehow complicated for simpler tasks.
    My goal would be to have mixed html/php code in the content - the reason is that I want to convert my actual HP into a Modx CMS and dont want to put all the php code in snippets.

    Sorry if this had come up earlier, but after a search I had no satisfied result.

    Thanks in advance for your answer!

    P.S. Im using latest modx versrion 9.6 I think.
      • 22303 MODX Staff
      • 10,725 Posts
      Presentation and logic are separated in MODx. You must isolate PHP code to snippets, plugins, and modules (or @EVAL in TV’s). In the future (0.9.7+) you may be able to override this behavior by introducing your own "class" of content elements that allow PHP tags to be mixed with static content, but it will likely not be part of the core offering. This clear distinction between presentation and logic is, IMHO, one of the key benefits of using the MODx framework; it makes you separate content from structure and logic, which is essential to creating an effective and maintainable CMS-powered site in most cases.