Global Content Blocks
[resolved] PHP blocks fail since intro of visual editor (3 posts)

  1. wp.Man
    Posted 2 years ago #

    UPDATE: this is due to addon "TinyMCE Advanced" if option to stop removing <p> and </ br> tags is enabled. hopefully a fix can be implemented in GCB? personally, if adding a PHP tag, i'd rather use a plain text editor with fixed width font

    since the introduction of the visual (WP) editor, PHP blocks such as...

    $str = file_get_contents('http://files.site.org/apps/sal/version');
    echo $str;

    fail with...

    Parse error: syntax error, unexpected '<' in /home/siteorg/public_html/wp-content/plugins/global-content-blocks/global-content-blocks.php(211) : eval()'d code on line 1

    existing blocks work fine as long as they are not edited/saved



  2. benz1
    Plugin Author

    Posted 2 years ago #

    Are you entering the PHP in HTML mode and not via the visual editor?

    I tried your code on a block and nothing appeared on the page, not even the parse error but I tried a
    echo 'your ip is '.$_SERVER['REMOTE_ADDR'];
    and it worked perfectly.

    I could look at diaabling the visual editor if PHP Code is selected as the type.

  3. wp.Man
    Posted 2 years ago #

    hi benz
    i tried in both in the visual and html editors, but as i mentioned this is due to the TinyMCE Advanced plugin

    i've switched to Ultimate TinyMCE and there's no problem

    if others complain then it might be something to take a closer look at, but i'm fine

    i would suggest possibly using a plain text editor for PHP code though


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Global Content Blocks
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.