Forums

Loop inside new php-exec plugin freezing widgets? (2 posts)

  1. badm00n
    Member
    Posted 1 year ago #

    hey - just upgraded to the new version of php-exec plugin and put some php code into a text widget for my blog. I have a loop that seems to be causing some problems that I didn't have in the older version of the plugin. Here is the code:

    <?php
    while ($i < 10) {
    $randnum = rand(1, $x) -1;
    if (!in_array($randnum, $numarray)) {
    $numarray[$i] = $randnum;
    $i++;
    }
    }
    ?>

    The code works fine when you look at the website, but now when i click on the widgets option in the admin panel it freezes up.

    The only way I can view my widgets again is to disable the php-exec plugin, go back to widgets and remove the loop.

    Any ideas as to what is causing the widget panel to freeze with loops?

  2. kulpreetsingh
    Member
    Posted 1 year ago #

    I would suggest instead of using the text widget to include php, you should just put the php directly in the template in your theme directory for your sidebar.php.

Topic Closed

This topic has been closed to new replies.

About this Topic