ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

conditional variable giving error :unexpected T_ENDIF

April 25, 2011 5:06pm

Subscribe [4]
  • #1 / Apr 25, 2011 5:06pm

    notebook

    31 posts

    i am using this condition variable

    {if extended_text != ""}<a href="http://{comment_url_title_auto_path}" class="more-link">Read more</a>{/if}

    Here extended_text is a custom field.

    It’s giving me this error

    Parse error: syntax error, unexpected T_ENDIF in /www/public_html/blog/system/expressionengine/libraries/Functions.php(650) : eval()‘d code on line 494

    Similarly if i use :

    {if post_image}
    {news_image}
    {/if}

    Here post_image is a custom field defined by me.

    it gives me the same error

    Parse error: syntax error, unexpected T_ENDIF in /www/public_html/blog/system/expressionengine/libraries/Functions.php(650) : eval()‘d code on line 496

    i am using EE ver 2.1.4

  • #2 / Apr 25, 2011 5:18pm

    vosSavant

    380 posts

    Hey there notebook,

    Try entering your variables like this, with curly braces and quotes:

    {if '{extended_text}' != ""}

    And:

    {if '{post_image}'}

    Does that fix anything?

  • #3 / Apr 25, 2011 5:34pm

    notebook

    31 posts

    Hey there notebook,

    Try entering your variables like this, with curly braces and quotes:

    {if '{extended_text}' != ""}

    And:

    {if '{post_image}'}

    Does that fix anything?

    Hi vosSavant again

    This code is working fine now

    {if '{extended_text}' != ""}

    But same error appeared for this code

    {if '{post_image}'}
  • #4 / Apr 25, 2011 5:41pm

    vosSavant

    380 posts

    Strange.

    You might try:

    {if '{post_image}' != ""}

    Or

    {if post_image != ""}

    The docs talk about when to use quotes here.

  • #5 / Apr 25, 2011 6:03pm

    notebook

    31 posts

    Strange.

    You might try:

    {if '{post_image}' != ""}

    Or

    {if post_image != ""}

    The docs talk about when to use quotes here.

    Same errors with these suggested codes as well , Also when i leave extended_text empty , same error appears for that as well.So it doesn’t help if the custom field is really empty.

    {if '{extended_text}' != ""}

    Error :

    Parse error: syntax error, unexpected T_ENDIF in /www/public_html/blog/system/expressionengine/libraries/Functions.php(650) : eval()‘d code on line 472

  • #6 / Apr 25, 2011 8:28pm

    vosSavant

    380 posts

    Out of curiosity, do you have PHP enabled, and if so—is it set to parse on input or output?

    Edit: It doesn’t look like you’re using PHP in the code snippet there, but do those variables have PHP in them?

  • #7 / Apr 26, 2011 1:37am

    notebook

    31 posts

    i am not using PHP in these codes myself , i am using them as they are described in documentation. I am using EE recommended host so i believe they must be using EE friendly settings for PHP , however i will ask them that if PHP is set to parse on input or output.

  • #8 / Apr 26, 2011 4:41am

    John Henry Donovan

    12339 posts

    notebook,

    however i will ask them that if PHP is set to parse on input or output

    No need to ask your host that as it is something you set yourself on a per template basis but you are not using PHP here so irrelevant

    The code examples you gave initially should be working without the quoting.

    I see you are using the beta. What build are you using? Is it the latest?

  • #9 / Apr 26, 2011 5:21am

    notebook

    31 posts

    Hi

    John

    i am using the latest beta ver 2.1.4 as suggested by a staff member here when i purchased this software. I have another account with another host , let me try it there , i’ll let you know soon.

  • #10 / Apr 26, 2011 6:41am

    notebook

    31 posts

    Hi again

    With same beta version 2.1.4 with another host the same codes are working fine. So as far as i can think it may be a problem with the host. What do you guys suggest ?
    Is there any script which checks the integrity of all files uploaded for EE ?

  • #11 / Apr 26, 2011 10:49am

    vosSavant

    380 posts

    notebook,

    I am still curious—are {post_image} or {extended_text} snippets with any PHP code in them? (It doesn’t look like you are using PHP here, but can’t hurt to double check).

    If not, it could be a difference in the PHP version on each host. You could upload a PHP file with the following in it to each host:

    <?php phpinfo(); ?>

    Then load up that file on each host and see what version each is running. EE’s minimum requirements are listed here.

  • #12 / Apr 26, 2011 11:15am

    notebook

    31 posts

    vosSavant

    The host on which this code is working fine runs

    PHP Version 5.2.14
    System : Linux 2.6.18-238.5.1.el5.centos.plus #1 2011 i686
    Memory Limit : 32 M

    And the one where it is not working has these specifications :

    PHP Version 5.3.2-1ubuntu4.7
    System : Linux 2.6.32-28-server #55-Ubuntu 2011 x86_64
    Memory : 64 M

    Also {post_image} or {extended_text} are custom fields created through Admin->Channel Administration->Custom Fields->Add/Edit Custom Fields so as such they can’t have any custom PHP in them and i have double checked it.

  • #13 / Apr 26, 2011 12:46pm

    vosSavant

    380 posts

    Hey notebook,

    Sorry, you told us all in your first post these are custom fields; I didn’t pay close attention :red:

    I can’t speak to your server configs; perhaps John can assist on that.

  • #14 / Apr 27, 2011 4:24pm

    Brandon Jones

    5500 posts

    Hi notebook,

    Let’s start with your very first code snippet. If you try just

    {if extended_text != ""}<a href="http://{comment_url_title_auto_path}" class="more-link">Read more</a>{/if}

    within the appropriate channel entries tag, and only this in a template, do you still get an error?

  • #15 / Apr 27, 2011 6:11pm

    notebook

    31 posts

    Hi
    Brandon

    Yes i still get the same error ,

    Parse error: syntax error, unexpected T_ENDIF in /www/public_html/blog/system/expressionengine/libraries/Functions.php(650) : eval()‘d code on line 561

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases