WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] php error (15 posts)

  1. ghoulsnghosts
    Member
    Posted 5 years ago #

    Hi there!
    got
    PHP Parse error: syntax error, unexpected T_ENDWHILE in /srv/vhosts/www.mydomain.com/htdocs/wordpress/wp-content/themes/p2.1.0.1/p2/functions.php on line 729, referer: http://www.mydomain.com/wordpress/wp-admin/themes.php
    when trying to preview this theme. Same error if I apply p2 to my website.
    Any ideas? thanks, have a nice day

  2. stvwlf
    Member
    Posted 5 years ago #

    It seems likely that is a coding error in the p2 theme's functions.php file. It's saying there is an endwhile statement in the wrong place. It often means the error is above that statement - it encountered the endwhile by falling through out of some unclosed If block for example.

    If you can't find it, if you post the contents of functions.php in a pastebin someone can help you locate the error.
    http://wordpress.pastebin.ca/

  3. ghoulsnghosts
    Member
    Posted 5 years ago #

    here it is :-)

    http://wordpress.pastebin.ca/1391885

    it's the default functions.php in p2 theme downloaded in the theme's directory.

  4. stvwlf
    Member
    Posted 5 years ago #

    Hi

    Line 1181 of that code is missing a closing PHP tag

    What is there

    <?php
    }

    What needs to be there

    <?php
    } ?>

    I haven't run the code - my syntax error checker found that. Give it a try and see if it resolves the problem.

    If it does, double check with the theme file you downloaded - if it is missing in the original file, let the theme author know so it can be corrected. It seems likely though that somehow it was removed in your installation only, as this would happen to everyone if it was in the distributed theme code.

  5. emsltek
    Member
    Posted 5 years ago #

    I am having the same problem on my self-hosted WP, running on WAMP. I tried adding the closing PHP tag, per stvwlf's post. When added, the same error occurs, but on line 730.

    I'm thinking the problem is not an absent closing PHP tag.

    WP 2.7.1
    MySQL 5.0.18
    PHP 5.1.2

  6. stvwlf
    Member
    Posted 5 years ago #

    Hi

    I'm not running the code and I don't see exactly what is going wrong. If you are both having this error in the same place, it is likely a bug in the theme code.

  7. noel
    Member
    Posted 5 years ago #

    Thanks for the notice. I'll take a look and figure out what is going on.

  8. ghoulsnghosts
    Member
    Posted 5 years ago #

    happened with every svn I tried these days, at the same point
    let us know :-)

  9. photogold
    Member
    Posted 5 years ago #

    just installed P2 . My website has disappeared http://www.photogold.co.uk
    . Error message
    "Fatal error: Cannot redeclare class Services_JSON in /home/322/first121/www.photogold.co.uk/public_html/wp-content/themes/p2/inc/JSON.php on line 116"
    what is wrong ?

  10. ghoulsnghosts
    Member
    Posted 5 years ago #

    problem persist even in 1.0.3

    PHP Parse error: syntax error, unexpected T_ENDWHILE in /srv/vhosts/www.mydomain.com/htdocs/wordpress/wp-content/themes/p2103/functions.php on line 729, referer: http://www.mydomain.com/wordpress/wp-admin/themes.php

    Noel, any news?

  11. noel
    Member
    Posted 5 years ago #

    @ghoulsnghosts Could you send me more specific information regarding your problem? php version other plugins you're running and perhaps any other errors that are showing up around there?

  12. ghoulsnghosts
    Member
    Posted 5 years ago #

    sure :-)

    When I try to preview the theme, It happens. The preview shows me a blank page. If I try to apply the theme to my site, gives me the same error on the error.log I already posted (internal server error in IE).

    WP 2.7.1
    Web server: Apache/2.2.4 (Linux/SUSE)
    MySQL: 5.0.45
    PHP Version 5.2.6

    Plugins: Akismet, Facebook Connector, Google Analytics for WordPress, Google XML Sitemaps, Sort by Comments, Whydowork Adsense, WordPress Database Backup, WP Recent Tags, WP Super Cache.

    Could it be related to http://wordpress.org/support/topic/255088#post-1047539 ?

  13. ghoulsnghosts
    Member
    Posted 5 years ago #

    with the fix n. 1 at http://wordpress.org/support/topic/255088 everything worked fine :-)

  14. emsltek
    Member
    Posted 5 years ago #

    Fix worked for me as well. Thanks @ghoulsnghosts for the pointer and thanks to @lilyfan for the solution.

    Here is @lilyfan's fix that worked for me (from http://wordpress.org/support/topic/255088):

    (1) There are two shorthand PHP tags. Because my server is "short_open_tag = Off", a PHP parse error was occur.

    The fix point is below.

    * line 429 of functions.php
    <div class="postcontent<?php if (current_user_can( 'edit_post', get_the_id() )) {?> editarea<?}?>"....

    should be:
    <div class="postcontent<?php if (current_user_can( 'edit_post', get_the_id() )) {?> editarea<?php } ?>"

    * line 27 of entry.php
    <div class="postcontent<?php if (current_user_can( 'edit_post', get_the_id() )) {?> editarea<?}?>"...
    shoud be:
    `<div class="postcontent<?php if (current_user_can( 'edit_post', get_the_id() )) {?> editarea<?php } ?>"

  15. noel
    Member
    Posted 5 years ago #

    The newest version of P2 fixes all of these issues.

Topic Closed

This topic has been closed to new replies.

About this Topic