Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

4 votes
Accepted

Conditional if else Problem

Try this: <h3> {if long_titles} {long_titles} {if:else} {title} {/if} </h3>
user avatar
  • 5,900
3 votes
Accepted

category id with if:else statement

This is what you will need to do. {exp:channel:categories style="linear"} {if "{category_id}" == "70"} ...
user avatar
  • 1,029
3 votes
Accepted

changing permissions on certain categories

Not exactly, but you could put your Channel Entries tag into an embedded template, and use a member group ID conditional to send it the parameters you want based on the visitors membership status. {...
user avatar
  • 2,255
2 votes

Advanced Conditions: {if:else} tag not getting read

As someone else has said this is an inelegant approach and there are better ways to do it. But for starters try putting the complete tag pair within each condition and see if that works. i.e. {...
user avatar
  • 7,176
2 votes

Advanced Conditions: {if:else} tag not getting read

Yikes! With all due respect, this is an extremely inelegant approach. You should never attempt to output different opening tags in this way. Even if you are able to somehow make it work, the next ...
user avatar
  • 4,885
2 votes
Accepted

I'm having trouble getting simple IF statements within a Playa tag to evaluate properly

There are some issues in EE 2.9 with conditionals on prefixed variables and variable modifiers which I don't totally grok. (See bug report here for some discussion.) But the moral is, try this: {if '...
user avatar
  • 17.4k
2 votes

Conditional statement issues

If I read your code correctly, you use Matrix field to keep images. Try next code for this: <div class="left article_image"> {if article_images:total_rows>0} <ul data-orbit> ...
user avatar
  • 5,781
2 votes

Is there a layout switcher in EE2?

If I understood what you want, maybe one of these add-ons can help you: Entry Type - A dropdown fieldtype that shows/hides other fields on the publish page; Better Pages - Better Pages is an ...
user avatar
  • 6,108
2 votes
Accepted

Is still necessary using the Add-on Ifelse from Mark Croxton with EE2.9?

It depends. If you aren't using variables on conditional outside the default order, you can remove ifElse. For example, ifElse parses early variables like member_id and group_id. Take some time to ...
user avatar
  • 6,108
2 votes

Conditional {if} and {if:else} Getting Error Message

You cannot close your exp:channel:entries-tag in a branch of the if-structure, because in case you have a banner (first branch) you finish the channel-loop and will not get to the end of the if-...
user avatar
  • 450
2 votes
Accepted

Checking the channel in the channel entries tag

try using channel_short_name == "work" You can find the short name in the list of channels. Also in your channel tag, you'll need to specify both channels. channel="work|latest"
user avatar
  • 1,987
2 votes
Accepted

If custom channel field entry exists display content else display alternate content

Have you tried this? The difference is on Line 2. It does mean you're running the conditional against the entire embed string rather than the variable but it may work. {slider} {if "{video}"!=""} ...
user avatar
  • 1,449
1 vote
Accepted

'IF' Conditional Not Working

It needs to look like this: {if segment_3 == "opening_night_concert1" XOR segment_3 == "the_greats" XOR segment_3 == "a_woodwind_affair"}
user avatar
  • 1,987
1 vote
Accepted

Conditional with if and ifelse not working

Option 1 - show nothing at all if there is no image: {if event_feature_image_04 OR event_feature_image_03 OR event_feature_image_02 OR event_feature_image_01} <img class="img-responsive ...
user avatar
  • 3,562
1 vote
Accepted

EE 2.5.5 how to use snippet in if statement

If you look at the parse order of the template engine, you'll see that although snippets do get parsed before conditionals, standard global variables (which includes {site_name}) don't get parsed ...
user avatar
  • 17.4k
1 vote

filter output with a loop: if {entry_id} not in array

If your goal is separate these specific entries and output them differently, use categories. You can then have content editors easily select (from the entry_form) entries that should be treated as ...
user avatar
  • 5,900
1 vote
Accepted

filter output with a loop: if {entry_id} not in array

Are you using version 2.9+? Which is the separator? Let's pretend you're and the separator is ,, giving you something like 1,2,3,4,5. Let's use the contains and the concatenation operators. Using ...
user avatar
  • 6,108
1 vote

If else condition involving contains on url-title?

You need some RegEx for that. Using the new conditionals operators of EECMS version 2.9: {if event_photo} {exp:imgsizer:size src="{event_photo}" alt="{title}" width="300" height="450" class="...
user avatar
  • 6,108
1 vote
Accepted

If statement parentheses not working correctly

It seems as though the conditions inside the parentheses don't need the curly braces. At least this has fixed it for me. {if (downloads:total_rows > 0 || section_2:total_rows == 1) && {...
user avatar
1 vote

If statement parentheses not working correctly

I would try putting your variables in curly braces: {if ({downloads:total_rows} > 0 || {section_2:total_rows} == 1) && {section_1:total_rows} == 1} Content ... {/if} You are making ...
user avatar
1 vote
Accepted

Advanced Conditions: {if:else} tag not getting read

You don't need any add-on to make this to work. Take a look at the docs. Segment variables as parsed before any module tags. Advanced conditionals are parsed after, but you can use simple ...
user avatar
  • 6,108
1 vote

Weird If statement behaviour inside channel:form

That sounds like expected behaviour. If you're using {author_id} in the context of a Channel Form then it is to submit and entry into ExpressionEngine. Therefore until you do make a submission the ...
user avatar
  • 5,407
1 vote

If condition for phpstringfun or streng?

I ran into trouble with streeng as well on doing just a find in a conditional, but it worked well with find+replace (ee 2.8.1), maybe hit up the developer. For phpstringfun, in the example you put up ...
user avatar
1 vote

nested if statements - a better way

It's certainly going to be more resource heavy that way, to be sure. One thing that could definitely help would be to use the early parsing conditional add-ons, switchee and ifelse to evaluate the ...
user avatar
1 vote

detect data is coming from which channel?

yes you can use EE {if} or {switchee} plugin both will work with u but u must use {channel_short_name} variable {channel} will give u the full channel name not the short one. I read in the EE User ...
user avatar
1 vote

detect data is coming from which channel?

You're almost there, you have to use the channel short name like this: {if channel == 'my_channel_name'}
user avatar
  • 3,163

Only top scored, non community-wiki answers of a minimum length are eligible