6
votes
Accepted
EE3 - When image description is blank, use title field
Try this:
<li class="large-4 small-3 columns">
{right_image_1}
{if description}
<img class="avatar w-alt" alt="{description}" src="{url}" />
{if:else}
<img ...
4
votes
Accepted
Conditional if else Problem
Try this:
<h3>
{if long_titles}
{long_titles}
{if:else}
{title}
{/if}
</h3>
4
votes
Accepted
EE: Show previous 3 blog entries prior to the current viewed entry
my guess would be you'll need an embed. the in the main template (within the channel:entries tag) call that embed something like this:
{exp:channel:entries}
{embed="_inc/_previous_three_posts" ...
4
votes
Accepted
Why is the OR not working in a conditional statement?
Well here is the issue. You are trying to give OR condition for 2 strings. OR condition will return true if any one of the given statements are true.
If you want to execute the code when url_title ...
3
votes
Accepted
Problem with category conditional
If I'm not mistaken, for OR conditionals you must use one of the following:
{if category_id != 305 OR category_id != 325}
{if category_id != 305 || category_id != 325}
also, please double check ...
3
votes
Need a Conditional for Tally
Looking at that plugin's code, it should work fine if you're using a tag pair, and its {tally_total} variable, e.g.:
{exp:tally:total}
{if ! tally_total}Your current total is 0.{/if}
{/exp:tally:...
3
votes
Accepted
How do I display alternative text when there are no active entries in a channel?
The reason your code is not working is because if ExpressionEngine does not return any results, then it doesn't even parse the tags - thus {total_entries} does not even exist in that context. Also ...
3
votes
Why is the OR not working in a conditional statement?
You should try your code in below manner.
{if ! 'portfolio|photos' *= segment_2}
<h1>Conditional content.</h1>
{/if}
You can also try in another way also.
{if segment_2 == '...
3
votes
Accepted
Matching more than one segment
I would use this to check multiple pages:
{if "page1|page2" *= segment_2} active {/if}
3
votes
Accepted
Relationship Field Conditional Not Working
Although it is technically less efficient, you should try embedding it to render as a tag in the conditional like so:
{if '{featured_movie:video_id}' != ''}
Try that. As in the docs, if it isn't ...
2
votes
Accepted
Limiting entry display after a conditional
Can't the numeric matching of the search parameter help you?
{exp:channel:entries channel="tours" search:departure_date=">{current_time}" limit="10" sort="asc" orderby="departure_date"}
[TEN ...
2
votes
Accepted
if statements that can alter a layout
Assuming 2 fields firstname and lastname...
<div class="{if lastname}half{if:else}full{/if}">
{firstname}
</div>
{if lastname}
<div class="half">
{lastname}
</div>
{/...
2
votes
Accepted
Why doesn't navigation conditional work?
See if wrapping segment_3 in matching quotes and curly brackets helps. I think I remember stumbling upon that issue in my early EE days and it dealing with parse order; keeping it matching helped in ...
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-...
2
votes
Issue with fluid fields and conditionals
Put quotes around the first half of your conditional, and change the inner quotes to single quotes (to stop EE parser getting confused) - something like:
{if "{westeros_content:count name='...
2
votes
Accepted
Simplify segment conditional documentation
The conditional operators that work in EE are listed in the documentation.
The two conditional forms you talk about are not equivalent, they just happen to give the same outputs for the inputs you ...
1
vote
Accepted
Checking if date field variables exist in templates
So, this is an old boat that doesn't always sail well (EE2 conditionals depending on field type [sorry for the random metaphor]).
Here is what you should start off by trying. First, make sure you ...
1
vote
Accepted
Conditional on select dropdown field type not working
Do you know, it will increase the speed if you don't put an if condition there and use EE search:CUSTOM_FIELD parameter in exp:channel:entries loop.
Use this:
{exp:channel:entries channel="news" ...
1
vote
Show different content based on url segement
Your syntax is accurate; products/product-detail should be embedded if segment_3 has a value. Perhaps you need to pass data into the embedded template?
Something like:
{embed="products/product-...
1
vote
Accepted
Grid Conditionals - side by side fields - only display if field filled
That's do-able, something like this should get you going, by using count conditionally you'll only ever get output if something exists:
{e_contact}
{if e_contact:count=="1"}
<span><i ...
1
vote
Conditional with "&" in comaprison string fails
You appear to be missing a " in your example - putting this back might fix things. If not, Romans-8 idea of using streeng seems viable. Something like:
{if {exp:streeng encode="yes"}title{/exp:...
1
vote
Showing Expired Entries Only. Not working
You can use condition like a below:
{if expiration_date < current_time AND expiration_date!=""}
Alternatively,you can use below query to get the records:
SELECT
t.entry_id,
t.title,
...
1
vote
Accepted
Need a Conditional for Tally
I contacted the plugin author about this issue and he gave me the following code:
{if '{exp:tally:total collection="hours"}' < 1}Your current total is 0.{/if}
This works perfectly and does ...
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"}
1
vote
Conditional statement using two different channels
You could do this with an embed by setting your embed with the author_id or author_name as a variable.
{embed="templategroup/templatename" authorName="{author_name}"}
embed:
{exp:channel:entries ...
1
vote
Accepted
How do I make content conditional on domain name?
You can use a conditional with {site_id} or {site_short_name}.
If you still want to set the condition based upon on the domain, you can use {site_url}.
1
vote
Accepted
Displaying Channel Form based on member group, number of entries/channel within a date range
Looks like your conditional logic is awry. Try something like:
{if logged_in}
{exp:member:custom_profile_data member_id="{logged_in_member_id}"}
{exp:channel:entries
channel="news"
...
1
vote
Accepted
Q re: nested conditional with grid rows
To do the searching you can simply replace the outer conditional with a search tag (which has the same syntax as the channel entries search tag). The {if} tag is pretty efficient in 2.11 so not an ...
1
vote
Accepted
Date conditional for over test if over 2 years
You're on the right track, but no bracing and formatting is needed; date variables will output timestamps without formatting, and comparisons can be made properly between integer types. So you can use ...
1
vote
Accepted
Does EE3 support preload-replace with conditionals in grid fields?
This is an instance were you will need to quote your conditional, since it's not a true variable. Starting in version 2.9.0, the conditionals parser learned how to behave, and parses conditionals as ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
conditionals × 312advanced-conditionals × 35
categories × 27
ifelse × 26
channel-entries × 22
templates × 18
stash × 17
relationships × 17
matrix × 16
playa × 15
ee2 × 13
segments × 13
grid × 12
parse-order × 11
date × 10
cartthrob × 9
members × 7
switchee × 7
safecracker × 6
pixelandtonic × 6
assets × 5
url × 5
channel-images × 5
embeds × 5
expresso-store × 4