phpmodxmodx-revolutionmodx-templates

MODX - why getting {$modx->getOption('<identifiers>')} on frontend?


I'm not an expert in MODX. But I work with PHP / Wordpress.

I got one MODX website to fix and I'm getting multiple pieces of text like: {$modx->getOption('<identifiers>')} on the frontend.

Could you give me a hint on how to start solving this?

I think that for some reason, that piece of code is not getting rendered on the frontend when it should do it.


Solution

  • In MODX, only snippets can contain PHP. Chunks, template, and content can only contain HTML markup (or other types of non-parsed content). This is to separate the logic from the markup.

    It sounds like you have some PHP code somewhere that doesn't support it.

    Alternatively if you do not have any code like that in your site, it could also be some server issue where one or multiple PHP files that MODX uses are being treated as a static file, instead of a PHP file that needs to be executed, but you'd likely see a lot more than just a $modx->getOption call.