Parse error with conditional
Posted: 30 April 2008 11:32 PM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  107
Joined  09-04-2007

I’m trying to do the same thing.  The if statement works when I check for ‘extended’ but if I check for ‘summary’ or ‘body’, I get a Parse error.

Any ideas?

[Mod edit: Split from this thread]

Profile
 
 
Posted: 01 May 2008 12:02 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

Please post the relevant part of your template, so we can see what’s going on.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 01 May 2008 12:07 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  107
Joined  09-04-2007

Hi Ingmar,

When I use ‘extended’, everything works as expected.

{if extended}
<p>
<
a href="{title_permalink=weblog/more}">MORE...</a>
</
p>
{/if}

When I use ‘summary’ or ‘body’, I get this error:

Parse error: syntax error, unexpected T_STRING in /home/xxxx/core/core.functions.php(637) : eval()‘d code on line 27

{if summary}
<p>
<
a href="{title_permalink=weblog/more}">MORE...</a>
</
p>
{/if}

Let me know if you need me to paste any more of the template.

Thanks!

Profile
 
 
Posted: 01 May 2008 02:22 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

You should be using it this way:

{if summary != ""}

But that is probably not the culprit.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 01 May 2008 04:07 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
RankRank
Total Posts:  107
Joined  09-04-2007

Yes, I tried that too but it still doesn’t work.  I get the same error :(

Profile
 
 
Posted: 01 May 2008 06:01 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
RankRank
Total Posts:  107
Joined  09-04-2007

I thought maybe the name of the Field was causing the problem so I renamed the summary field to summary22 and updated the if statement in the template to summary22 and the problem still occurred.

Here’s the code in the core file that is mentioned in the error:

function evaluate($str)
    
{    
        
return eval('?>'.$str.'<?php ');
        
        
// ?><?php // BBEdit syntax coloring bug fix
    
}
    
/* END */

The return statement is line 637.  I’m not sure what line 27 in the error message is referring to.

I’ve also tried this on a local install and am having the same issue..  Also, I am using 1.6.3

Profile
 
 
Posted: 02 May 2008 02:05 PM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

Can you attach a bit more of your template? Nothing that catches my eye immediately.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 02 May 2008 02:11 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
RankRank
Total Posts:  107
Joined  09-04-2007

Well, I’ve whittled down the template to just this and I’m still getting the same error:

{exp:weblog:entries weblog="xxxxxxx" orderby="date" sort="desc" limit="10" disable="member_data|trackbacks"}
                    
{if summary
!= ""}
<p>
<
a href="{title_permalink=weblog/more}">MORE...</a>
</
p>
{/if}

{
/exp:weblog:entries}

Works fine if I change ‘summary’ to ‘extended’.  The field group for this weblog has three fields:
summary
body
extended

Both the summary and body fields are of the WYSIWYG type (I’m using the TinyMCE plugin).  I changed the summary field back to Textarea and it still didn’t work.

Strange huh?

Profile
 
 
Posted: 04 May 2008 08:48 AM   [ Ignore ]   [ # 8 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23547
Joined  05-20-2002

Yep- makes no sense.  What build/version are you running?  And on that test template- run it real quick, make sure it’s still showing the error.  Then change it to:

{exp:weblog:entries weblog="xxxxxxx" orderby="date" sort="desc" limit="10" disable="member_data|trackbacks"}
               
{summary}
<hr>

{/exp:weblog:entries}


Summary parsed ok that way?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 04 May 2008 01:07 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
RankRank
Total Posts:  107
Joined  09-04-2007

I’m running 1.6.3

When I tried the code you suggested, everything displayed properly.

Profile
 
 
Posted: 04 May 2008 08:35 PM   [ Ignore ]   [ # 10 ]  
Summer Student
Total Posts:  8
Joined  04-15-2008

We are having a very similar problem with the site we are attempting to build here. We’ve tracked it down a bit further here.

It seems that this error only occurs if we have a bad trailing character in a field that we are using as the conditional.

Honestly, the only time we’ve come across is it when there is a “\” character at the end of the field. We’ve assumed that it simply escapes the following end quote character, and PHP throws a hissy fit. 

We’ve been unsuccessful in attempting to fix it ourselves however

So that could be your problem. I actually came in to post asking if there was a workaround for that exact problem. We don’t really want to change the source code of the EE Installation, as that becomes a nightmare for maintenance if we have multiple environments.

Obviously, we will instruct people who are publishing articles to NOT use a trailing slash, but most of the keyboards we have here have the “\” immediately above the enter key, and accidents will happen.

So, to make a rather long story short, is the trailing “\” a known issue, and is there a way to get around it?

Profile
 
 
Posted: 04 May 2008 10:45 PM   [ Ignore ]   [ # 11 ]  
Lab Assistant
RankRank
Total Posts:  107
Joined  09-04-2007

Thanks NDM-CareerOne!  I am also able to verify that a ‘\’ at the end of the field causes the same problem.

I took a look at the content we placed in our summary field and although I didn’t see a ‘\’ at the end of the field, I did notice a problem with the tags for the Videoplug extension:

[youtube]Vq7rrQMgUGs[/youtube]

I changed the # of entries returned from 10 to 1 and when I took the youtube tags out, the code worked fine.  When I put the youtube tags in, I received the parse error.

Looking into it a little more, I discovered that

[youtube]Vq7rrQMgUGs[/youtube

did not cause the problem.

I thought maybe the code that Videoplug produced could be the problem.  I replaced

[youtube]Vq7rrQMgUGs[/youtube

with

<object type="application/x-shockwave-flash" style="width:425px; height:350px;" data="http://www.youtube.com/v/Vq7rrQMgUGs">
<
param name="movie" value="http://www.youtube.com/v/jBEYyHGbwto" /></object></p>

and that worked fine.

When I disable the Videoplug extension, it works fine.  Unfortunately, we need to use that extension in our posts. 

Could it be possible that these two issues are related?

Any ideas?

Profile
 
 
Posted: 05 May 2008 07:50 AM   [ Ignore ]   [ # 12 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23547
Joined  05-20-2002

I duplicate the backslash issue on my install.  It seems like a bug to me- but let me check with the crew on this one.

triom- seems related to me- but I’m not entirely up on that plugin and I’m not sure if the issue is with the plugin or with EE.  I’m going to give the crew a ‘heads up’ and see if we can get some clarification on that one.

Will let you know as soon as they chime in.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 05 May 2008 10:25 AM   [ Ignore ]   [ # 13 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23547
Joined  05-20-2002

OK- looks like a bug on the slash issue- and I’ve reported as such.  The youtube being a third party one, we’re less certain about.  Is this for the forum or the weblog- and can you link to the plugin?  Best way to resolve it is drop the plugin author a note or post to the plugin forum.  But it may/may not be related to the bug, so I wanted a bit more info.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 05 May 2008 10:46 AM   [ Ignore ]   [ # 14 ]  
Lab Assistant
RankRank
Total Posts:  107
Joined  09-04-2007

The error with the conditional occurs in my weblog. 

Here are the links to the Videoplug extension:
http://expressionengine.com/wiki/videoplug/
http://www.lars-kirchhoff.de/go/code/info/expressionengine-video-extension/
http://expressionengine.com/forums/viewthread/42152/P0/

I’ve also notified the author, Lars Kirchhoff, about this issue via PM and sent him a link to this thread.

Glad to hear EE is working on this bug.  Thanks!

Profile
 
 
Posted: 05 May 2008 01:32 PM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  106
Joined  09-21-2004

Hi triom,

I’ve checked the plugin and found the problem. The plugin uses the weblog_entries_tagdata_end hook, which is supposed to

Take the final result from an entry’s parsing and do what you will.

Unfortunately not everything is parsed at this stage. The conditional statements are still in the template together with the already translated weblog fields. This results in a template which has the content of each weblog field twice: first within the quotes of conditional statement and second where the actual content is placed.

As a weblog field’s content may have quotes

"

in itself, like the one necessary for the object embed, the if statement is broken. I’ve replace all occurrences of

"

with

\'

and now the plugin works with conditional statements, too. I’ve uploaded the new version, which you can now download from here:
http://www.lars-kirchhoff.de/go/code/info/expressionengine-video-extension/

ciao Lars

 Signature 

http://www.lars-kirchhoff.de

Profile
 
 
Posted: 05 May 2008 01:39 PM   [ Ignore ]   [ # 16 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

Thanks Lars. triom, does that solve or at least explain the issue for you for the time being? Robin has filed a bug report, thanks for helpoing us tracking that down.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 05 May 2008 02:39 PM   [ Ignore ]   [ # 17 ]  
Lab Assistant
RankRank
Total Posts:  107
Joined  09-04-2007

Thank you Lars!  The updated extension seems to work just fine with conditionals.  That was FAST! cool grin

Ingmar, Yes this has both explained and solved my issue.  Thank you grin

Profile
 
 
Posted: 05 May 2008 02:50 PM   [ Ignore ]   [ # 18 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

Excellent.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65087 Total Logged-in Users: 40
Total Topics: 82229 Total Anonymous Users: 21
Total Replies: 441930 Total Guests: 213
Total Posts: 524159    
Members ( View Memberlist )