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

    when I try to load a snippet in a snippet I get this error.
    Parse error: parse error, unexpected ’<’ in /home/.sites/106/site51/.users/100/sd/web/modx/manager/includes/document.parser.class.inc.php(748) : eval()’d code on line 2

    I think it’s because the following is happening:
    <?
    $modx->runSnippet(’tester’);
    ?>

    <---- tester---->

    <?
    echo"hello world";
    ?>


    so what happends is this: <? <? echo"hello world"; ?> ?>

    any ideas how to fix this
      • 22303 MODX Staff
      • 10,725 Posts
      You cannot use PHP tags inside a snippet.
        • 27101
        • 10 Posts
        well if I delete the php tags it ads them after I saved the snippet.

        it won’t allow me not to use php tags...
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The opening and closing php tags are automatically added for snippets (this is so that the context coloring plugins will know to use php syntax for code highlighting). Do not add them in your own snippet code.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 27101
            • 10 Posts
            well that’s the whole issue I don’t,
            but still it keeps giving this message while it shouldn’t tongue

            when I open the snippet it actually says:
            <?
            echo"hello world";
            ?>

            so no duble tags what so ever,
            but nevermind, I will use the include functie to make it work.
              • 27376
              • 576 Posts
              Try making the first tag [tt]<?php[/tt] instead of just [tt]<?[/tt]. Also what revision are you using (Look at ’version codename’ under Reports -> System Info).