Support » Plugin: Shortcode Exec PHP » [Plugin: Shortcode Exec PHP] doesn't work

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor M66B

    (@m66b)

    Could you please post the error message?

    I didn’t realize I had tried this plugin before but I just reinstalled it again. Same results so I came here for support and found my own post. (This time I’m checkmarking the ‘notify me of follow-up posts’)

    This plugin sounds like a perfect solution for my needs, where I’d like to keep the php code out of the pages themselves because other, less-experienced editors could mess it up.

    When I click the test button (and when I add the test shortcode on a page) I get the following message:

    [php_test]=”
    <b>Parse error</b>: syntax error, unexpected ‘<‘ in <b>/home/xxxmyaccountxxx/public_html/xxxmydomainxxx/wp-content/plugins/shortcode-exec-php/shortcode-exec-php-class.php(1069) : eval()’d code</b> on line <b>1</b>

    Plugin Contributor M66B

    (@m66b)

    This message means that there is a syntax error in your shortcode definition.

    I can help you with this, but you’ll have to post the shortcode definition.

    This is all straight out of the box. At first the shortcode said [test] but thought that may conflict with something so I changed it to [php_test]. In both cases it didn’t work.

    As for the code being executed, it is exactly the default.

    <?

    <p style=”text-align: center;”>test</p>

    ?>

    I haven’t touched any settings.

    Plugin Contributor M66B

    (@m66b)

    That is not the example code out of the box and it is indeed wrong.
    Try it like this:

    ?>
    <p style="text-align: center;">test</p>
    <?php

    Thanks for the help. All I see different is the ?> and <?php being reversed but I tried it anyway and go the same error code. So I then decided to change the code to be executed to nothing other than <b>test</b> and still got the same results. Must not be a problem with the php code trying to be executed by the shortcode.

    `[test3]=”
    <b>Parse error</b>: syntax error, unexpected $end in <b>/home/xxxxx/public_html/xxxxx.net/wp-content/plugins/shortcode-exec-php/shortcode-exec-php-class.php(1069) : eval()’d code</b> on line <b>1</b>
    “‘

    Plugin Contributor M66B

    (@m66b)

    It is definitely a problem with the shortcode (because eval()’d code on line 1).

    And <b>test</b> is not PHP but HTML, so you must use the closing PHP tag and after it the PHP opening tag again.

    Try this to see that it works:

    echo 'Test';

    (no PHP opening and closing tags, because this is PHP code).

    This plugin is not meant for HTML (although it is possible to a certain extend).

    Hey, that one worked!!! Thanks!!!

    So I’ll have to test later with the code I really want to use, but it seems that the <? and ?> are not necessary for the php code itself? (The default test code that was there did have those characters at the top and bottom so I assumed they needed to be there. If that’s not normal than I wonder how that happened on two different fresh install.)

    And if my code has non-php elements in it, I suppose I should just go through the effort of changing it to php standards, right?

    Thanks again.

    Plugin Contributor M66B

    (@m66b)

    So I’ll have to test later with the code I really want to use, but it seems that the <? and ?> are not necessary for the php code itself?

    No, these are not necessary.

    The default test code that was there did have those characters at the top and bottom so I assumed they needed to be there. If that’s not normal than I wonder how that happened on two different fresh install

    The default test code does not contain PHP starting and ending tags.

    The default test code is:

    extract(shortcode_atts(array('arg' => 'default'), $atts));
    echo "Hello world!" . PHP_EOL;
    echo "Arg=" . $arg . PHP_EOL;
    echo "Content=" . $content . PHP_EOL;

    And if my code has non-php elements in it, I suppose I should just go through the effort of changing it to php standards, right?

    Yes, or use PHP closing and opening tags for HTML code.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Shortcode Exec PHP] doesn't work’ is closed to new replies.