Can Someone Tell Me The Error With This PHP Code?

7 replies
Code:
<?php wpp_get_mostpopular("range=weekly&limit=6&thumbnail_width=90&thumbnail_height=60&stats_comments=0&post_html="<li>{thumb}<a href='{url}'>{text_title}</a></li>""); ?>
Where's the error?

I keep getting following error message:

"Parse error: syntax error, unexpected '>' in C:\xxxxx\xxxx\htdocs\xxx.com\wp-content\themes\xxx\single-videos.php on line 120"

Please Help!

Regards
#code #error #php #php error #programming error
  • Profile picture of the author howudoin
    The error usually comes after adding the "post_html" parameter & this PHP function is on line 120.

    Regards
    {{ DiscussionBoard.errors[8208620].message }}
  • Profile picture of the author momtraders
    Nevermind, I am still looking hold on a min...
    {{ DiscussionBoard.errors[8208643].message }}
    • Profile picture of the author Brandon Tanner
      You can't put double quotes inside a pair of double quotes without escaping them (and same thing is true with single quotes). Try this instead...

      PHP Code:
      <?php wpp_get_mostpopular("range=weekly&limit=6&thumbnail_width=90&thumbnail_height=60&stats_comments=0&post_html='<li>{thumb}<a href=\'{url}\'>{text_title}</a></li>'"); ?>
      Signature

      {{ DiscussionBoard.errors[8208709].message }}
      • Profile picture of the author howudoin
        Originally Posted by Brandon Tanner View Post

        You can't put double quotes inside a pair of double quotes without escaping them (and same thing is true with single quotes). Try this instead...

        PHP Code:
        <?php wpp_get_mostpopular("range=weekly&limit=6&thumbnail_width=90&thumbnail_height=60&stats_comments=0&post_html='<li>{thumb}<a href=\'{url}\'>{text_title}</a></li>'"); ?>
        Thanks buddy!

        You're a lifesaver.

        Your solution was pretty close, but I also had to get rid of single quotes.

        I used the following instead & it worked!

        Code:
        post_html=<li>{thumb}<a href=\'{url}\'>{text_title}</a></li>
        It also works if you get rid of "<li>" tag altogether.

        By the way, this code is relevant to "WordPress Popular Posts" plugin.

        Regards
        {{ DiscussionBoard.errors[8209852].message }}
  • Profile picture of the author momtraders
    Try adding a closing php to the code, before the html.
    {{ DiscussionBoard.errors[8208691].message }}
  • Profile picture of the author momtraders
    Nice job Brandon
    {{ DiscussionBoard.errors[8208717].message }}
  • Profile picture of the author snoopie
    Code:
    <?php wpp_get_mostpopular("range=weekly&limit=6&thumbnail_width=90&thumbnail_height=60&stats_comments=0&post_html=\"<li>{thumb}<a href='{url}'>{text_title}</a></li>\""); 
    ?>
    Escape the double quotes
    {{ DiscussionBoard.errors[8246926].message }}

Trending Topics