Skip to main content
Share Your Experience: Take the 2024 Developer Survey
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 ...
Kevin Carpenter's user avatar
4 votes
Accepted

Conditional if else Problem

Try this: <h3> {if long_titles} {long_titles} {if:else} {title} {/if} </h3>
jrothafer's user avatar
  • 5,900
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" ...
Jelle Dijkstra's user avatar
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 ...
Mufi - Amici Infotech's user avatar
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 == '...
Harsh Barach's user avatar
3 votes
Accepted

Matching more than one segment

I would use this to check multiple pages: {if "page1|page2" *= segment_2} active {/if}
Mufi - Amici Infotech's user avatar
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 ...
pixldev's user avatar
  • 589
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:...
Derek Jones's user avatar
  • 2,255
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 ...
jrothafer's user avatar
  • 5,900
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> {/...
Peter Lewis's user avatar
  • 5,353
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 ...
Kerry Johnson's user avatar
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-...
BNetz's user avatar
  • 470
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='...
JCOGS Design's user avatar
  • 3,585
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 ...
JCOGS Design's user avatar
  • 3,585
2 votes

Embedded template variables and conditionals?

I think your problem is that you're not using the correct variable name in the conditional. When you send a variable in an embed, the variable on the other end is {embed:variable_name}, not {...
Jason Boothman's user avatar
1 vote

Setting up Fields and Logic

If you are using EE5 then one solution would be to use a Fluid field. Set up the Fluid field to allow the user to pick one of three fields (one for each of your cases) and then in your template you ...
JCOGS Design's user avatar
  • 3,585
1 vote

Matching more than one segment

You can try below code. {if segment_2 == "page1" || segment_2 == "page2"} nav-expanded nav-active {/if} I hope this will works for you.
Harsh Barach's user avatar
1 vote
Accepted

How to detect an AJAX request in a EE4 template?

Use the native {is_ajax_request} variable.
Low's user avatar
  • 11.3k
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 ...
jrothafer's user avatar
  • 5,900
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" ...
Mufi - Amici Infotech's user avatar
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-...
Will Diaz's user avatar
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 ...
stuartmcd69's user avatar
  • 3,163
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:...
JCOGS Design's user avatar
  • 3,585
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, ...
Jainil's user avatar
  • 626
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 ...
Andrew Currie's user avatar
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"}
Jim Wyse's user avatar
  • 1,987
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 ...
pixldev's user avatar
  • 589
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}.
pixldev's user avatar
  • 589
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" ...
JCOGS Design's user avatar
  • 3,585
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 ...
JCOGS Design's user avatar
  • 3,585

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