WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code Widget
[resolved] Executable PHP widget - Not Working (6 posts)

  1. acmc
    Member
    Posted 2 years ago #

    Uploaded executed the plugin

    I have a custom widgetized sidebar on a template page.

    Put in a query post call - showed nothing

    Put in text - it's there

    Put in the <?php echo 'testing!'; ?> and that didn't show either...

    Hu?

    I have used this plugin before and it worked beautifully and unsure what I am doing wrong. Any help greatly appreciated.

    Thanks

    **Ann

    http://wordpress.org/extend/plugins/php-code-widget/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Dunno. Works fine for me.

    Do you have any sort of caching plugins like super-cache or similar? Maybe you're only seeing the cached version of the page. Clear the cache in that case.

  3. souf
    Member
    Posted 2 years ago #

    Hi,
    I try to put only a include:
    <?php include("http://url_smf/SSI.php?ssi_function=recentTopics"; ?>
    And didn't work:
    Parse error: syntax error, unexpected ';' in /path_to_wordpress/wp-content/plugins/php-code-widget/execphp.php(44) : eval()'d code on line 1

    function widget( $args, $instance ) {
    		extract($args);
    		$title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance );
    		$text = apply_filters( 'widget_execphp', $instance['text'], $instance );
    		echo $before_widget;
    		if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
    			ob_start();
    /*Line 44*/		eval('?>'.$text);
    			$text = ob_get_contents();
    			ob_end_clean();
    			?>
    			<div class="execphpwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div>
    		<?php
    		echo $after_widget;
    	}

    I didn't known the problem (it's not the problem for use " or ').
    I try to put a simple echo "Hello World", and it works, but not with an a include...
    Thanks

  4. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Well, this:
    <?php include("http://url_smf/SSI.php?ssi_function=recentTopics"; ?>

    Isn't valid PHP code.

    For one thing, you're missing the closing parenth.

    For another, you're trying to include an HTTP URL as PHP code, which is incorrect.

  5. souf
    Member
    Posted 2 years ago #

    Sorry, I typed incorrectly the php code in the message, but it was right in the widget:
    <?php include("http://url_smf/SSI.php?ssi_function=recentTopics"); ?>
    I wrote this because it was only to simplify the php code and it would be more easily understood.

    Finally, if I include the php file, it works, but not with include("...")

    The final code:

    <ul>
    <?php
    require("/path_to_smf/SSI.php");
    $Lista = ssi_recentPosts($num_recent = 10, $exclude_boards = null, $include_boards = null, $output_method = 'array');
    foreach ($Lista as $Post) {
    
    echo '<li><a target="_blank" href=', $Post['href'], '>', $Post['subject'], '</a></li>';
    
    }
    unset($Lista);
    ?>
    </ul>

    Thanks

  6. John
    Member
    Posted 2 years ago #

    Hello there!
    It just can't execute shortcodes?? Very useful, miss this functionallity in this plugin.
    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic