• Resolved agentsully

    (@agentsully)


    I have the popularity contest plugin running on my site:

    http://lifelearningtoday.com

    I just tried to put it into the sidebar using an ExecPHP sidebar widget.

    This is the code I put into the widget:

    <?php akpc_most_popular($limit = 10, $before =
    <li>, $after = </li>
    ); ?>

    And this is the error I got:

    Parse error: syntax error, unexpected T_STRING in wp-content/plugins/widgets/execphp.php(24) : eval()’d code on line 1

    Can anyone lend assistance with correcting this? Thank you!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter agentsully

    (@agentsully)

    oops, here’s the code

    // <?php akpc_most_popular($limit = 10, $before =
    <li>, $after = </li>
    ); ?> //

    forgot to use backticks when putting in the code.

    thx.

    I’m widget intolerant, so I’ve not used the execphp widget yet…

    but does it work better if you don’t include the opening <?php and closing ?> tags?

    Thread Starter agentsully

    (@agentsully)

    tried your suggestion but the execphp widget says that the code must be inside those tags.

    maybe Otto will pick up on this thread. I’ll give him the link to this.

    I use windows not mac, if that has any significance.

    Thanks Handy. Like your new look on your site BTW.

    Thread Starter agentsully

    (@agentsully)

    regarding the execphp widgets, my “Top Commentators” doesn’t look too pretty and if it’s not at the bottom, things get all messed up formatting wise.

    so it seems that the issue is with execphp…perhaps.

    Thanks Handy. Like your new look on your site BTW.

    Thank you kindly.

    Regarding the original issue: Have you tried simplifying the function call a bit, just to ensure it isn’t a parameter? Maybe something like:
    <?php akpc_most_popular($limit = 7); ?>
    ?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Any error that it throws with “eval” in there means that the code you put into it is somehow wrong. There’s nothing wrong with the ExecPHP widget, all it’s really doing is running your code through an eval() statement. Other than that one minor difference, it’s basically identical to the normal Text widgets.

    And yes, the <?php and ?> tags are required.

    In particular, this code:

    <?php akpc_most_popular($limit = 10, $before =
    <li>, $after = </li>
    ); ?>

    Doesn’t make any sense at all. Perhaps you’re actually wanting to do this?
    <?php akpc_most_popular(10, '<li>', '</li>'); ?>

    Thread Starter agentsully

    (@agentsully)

    Otto, Thank you for responding here!

    Your fix is correct for the plugin to display. Thx!

    There is one other thing too. If you look at my site in IE you’ll see on the left sidebar at the bottom, the Top Commentators leaks into the background color not the white sidebar that it is supposed to be in.

    Also if I move that widget to any other location it completely fouls up the formatting of the whole blog, like crazy. If it is not at the bottom things look a mess. If it is at the bottom over on the right hand column everything becomes centered (the posts and all widgets).

    That’s why I don’t have the Popular Posts in there yet, because it breaks my formatting to do so.

    Any suggestions? I am deeply grateful in advance of your reply! Thx.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    You need to edit that widget and add <ul> and </ul> around the function call that you’re making. Why? Because the html it’s creating has each link inside of an li tag, but you don’t have a list around those for the li tags to make sense.

    Just edit the widget and change this:
    <?php your_function_call(); ?>

    to this:

    <ul>
    <?php your_function_call(); ?>
    </ul>

    Thread Starter agentsully

    (@agentsully)

    Otto, You’re a lifesaver! I know I probably look like a dummie, not knowing that already. But I’m learning. I thank you so much!!

    And thank you HandySolo for taking the time to help also!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘need help: popularity contest in sidebar’ is closed to new replies.