This Question is Resolved.

If you have a similiar issue that this thread does not address, click the button below to open a new related support topic.

 
 
{if} block makes {if:else} block not valid - Multi Language, Nested field/globals
Posted: 27 June 2008 01:13 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  307
Joined  01-20-2006

Man this is a weird one.

Using the Wiki’d Multi-language, setting a global variable of {country_code} in the path.php file.
For this language in the site, {country_code} is set to “fr”.
My custom fields are setup so that {cf_field_name_{country_code}} == {cf_field_name_fr}, allowing dynamic language additions, with the right fields.

This code, returns examples successfully with “-fr” titles.

<h4>Locations</h4>
{exp:weblog:entries weblog="about_int_locations" dynamic="off"}
<li>< a href = "{title_permalink="{segment_1}/{segment_2}"}">
{if country_code != "en" AND cf_title_{country_code} != ""}{cf_title_{country_code}}{if:else}{title}{/if}</a>
</
li>
{/exp:weblog:entries}

RETURNS
:

Locations
# Belgium (fr)
# Australia (fr)
# Napierville (fr)

This second block however returns with the default (english) fields.
The only difference is placing an if count== conditional inside the weblog:entries instead of leaving the static tag outside the weblog:entries block.

{exp:weblog:entries weblog="about_int_locations" dynamic="off"}
{if count
=="1"}<h4>Locations</h4>{/if}
<li>< a href = "{title_permalink="{segment_1}/{segment_2}"}">
{if country_code != "en" AND cf_title_{country_code} != ""}{cf_title_{country_code}}{if:else}{title}{/if}</a>
</
li>
{/exp:weblog:entries}

RETURNS
:
Locations
# Belgium
# Australia
# Napierville

Now that I know how to reproduce that error, I can work around it, but I’d still like to figure this one out if I can.


*NOTE: This same phenomenon happens inside reverse related entries tags as well. Probably others.
**NOTE2: This can be worked around by calling an embed for the given entry. Then I can use all if blocks I want in the wrapping weblog:entries tag without any problem.

Image Attachments
Picture 1.pngPicture 2.png
Click thumbnail to see full-size image
 Signature 

AJ Penninga
Pretty Squares, LLC - http://www.prettysquares.com

Profile
 
 
Posted: 01 July 2008 07:11 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  582
Joined  04-29-2008

Looking into this one now.

Profile
 
 
Posted: 05 July 2008 04:42 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  582
Joined  04-29-2008

Greetings,

After some investigation, I found that this issue is a known issue found here. We are working on a solution. Thank you for the report.

Profile
 
 
Posted: 07 July 2008 11:47 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  307
Joined  01-20-2006

Thanks for your help Justin.

I’m not sure I follow on how that’s the same issue. Any chance you could show me where my errors are?

From what I see in my code, the bug I’m getting is when there is an {if} conditional present vs an {if} AND an {if:else} block present (2 separate blocks).
I do notice I use a global variable in my conditionals, but it’s in the “left” side of the conditional, correct?

 Signature 

AJ Penninga
Pretty Squares, LLC - http://www.prettysquares.com

Profile
 
 
Posted: 07 July 2008 12:11 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  582
Joined  04-29-2008

Sure thing,

If you were to turn on errors, you would see something like this when adding the {if count==“1”}

Warning: Invalid EE Conditional Variable: {if "6"ry_code != "fr" AND field_title_en != ""} in ....

It never evaluates to true because ‘count’ is replacing ‘count’ry. So the {if:else} is executed.

Profile
 
 
Posted: 07 July 2008 12:21 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  879
Joined  02-05-2002

Does the following code work?

{if "{country_code}" != "en" AND "{cf_title_{country_code}}" != ""}

This example is just comparing ‘strings’ instead of variables.

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 07 July 2008 12:29 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  307
Joined  01-20-2006

Ahhhhh. Of course.
Kinda forgot about that {count} variable.

 Signature 

AJ Penninga
Pretty Squares, LLC - http://www.prettysquares.com

Profile
 
 
Posted: 07 July 2008 12:46 PM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  879
Joined  02-05-2002
Justin Hurlburt - 07 July 2008 12:11 PM

It never evaluates to true because ‘count’ is replacing ‘count’ry.

Sounds like a bug to me.

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 07 July 2008 12:54 PM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  582
Joined  04-29-2008
Cocoaholic - 07 July 2008 12:46 PM
Justin Hurlburt - 07 July 2008 12:11 PM

It never evaluates to true because ‘count’ is replacing ‘count’ry.

Sounds like a bug to me.

Yes, as noted in reply #2

Profile
 
 
Posted: 07 July 2008 01:13 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  879
Joined  02-05-2002

Oops, didn’t see that.

Thanks for looking into this though smile

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 07 July 2008 01:45 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  307
Joined  01-20-2006

Sweet, thanks for the help. I’m looking to remove the global variable version of multi-lingual and switch to leevi’s plugin now that he’s got it working for all url segments, not just subdomains and EE url segments.

 Signature 

AJ Penninga
Pretty Squares, LLC - http://www.prettysquares.com

Profile
 
 
Posted: 10 July 2008 01:18 PM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  582
Joined  04-29-2008

housekeeping.

Profile
 
 
 

This Question is Resolved.

If you have a similiar issue that this thread does not address, click the button below to open a new related support topic.

 
 
 
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: 64917 Total Logged-in Users: 25
Total Topics: 81870 Total Anonymous Users: 17
Total Replies: 440152 Total Guests: 183
Total Posts: 522022    
Members ( View Memberlist )