• linchen

    (@linchen)


    Hello
    i added this extension (and activate plugin) but PHP dont work

    <?php
    /*
    Plugin Name: WP-Table Reloaded Extensions
    Plugin URI: https://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/extensions/
    Description: Custom Extensions for WP-Table Reloaded
    Version: 1.0
    Author: YOU, Tobias Baethge
    */
    /**
     * Executes PHP code in table cells
     * @author Tobias Baethge
     * @see https://tobias.baethge.com/2010/02/extension-5-how-to-use-php-in-table-cells/
     */
    function wp_table_reloaded_execute_php_in_cells( $cell_content ) {
        ob_start();
        eval( '?>' . $cell_content );
        $output = ob_get_clean();
        return $output;
    }
    add_filter( 'wp_table_reloaded_cell_content', 'wp_table_reloaded_execute_php_in_cells' );
    ?>

    This is working:
    <?php echo "Hallo";?>
    This dont work
    <?php echo $hallo;?>
    The variable is exist and not empty.

    I use WordPress 3.1

    Greeting
    Linchen

Viewing 5 replies - 16 through 20 (of 20 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks a lot for this feedback!

    You are right, I totally forgot about this before. This happens, because line breaks in table cells are turned into HTML <br/> tags when the table is shown, therefore there can not be any line breaks in the PHP code.
    (There is a way to alter that behavior with a plugin filter, but as that affects all tables, I don’t recommend it.)

    Best wishes,
    Tobias

    Hi

    i have the same problem, mentioned here in this post.

    But: i write the include command in 1 line, but now I see nothing. A blank site :-/

    This is the code in the table:
    <?phpinclude(“/www/htdocs/xxxxx/show_on_startseite.php”);?>

    When i open the php file in a new browser window it works, but not in the table.
    any ideas?

    greetings
    clemens

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi Clemens,

    thanks for your question.

    Is this the exact code that you are using? Because there is a space missing between <?php and include.

    Do you maybe have any error messages in the error log on your server?

    Regards,
    Tobias

    oh danke
    es geht ??

    LG

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    no problem ??
    And don’t forget to turn off “Table Output Caching” for this table, in case you haven’t, as otherwise the contents will not get updated at the same time as the PHP file changes.

    Best wishes,
    Tobias

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘[Plugin: WP-Table Reloaded] PHP Extensions dont show variables’ is closed to new replies.