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
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
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
Conditional logic inside of <script> tags
OK, I feel like an idiot! Forgot about the Javascript template type.
Solution: I simply created a new template, designated it as type "JavaScript", inserted my code, minus the <script> tags, ...
2
votes
is it healthy to built a web services or a web app using EE?
The real value/power of EE is in the control panel, and how quickly you can pull together complex data-driven sites by not having to build an admin interface. I'm currently building a mobile app that ...
2
votes
is it healthy to built a web services or a web app using EE?
It's really a matter of "it depends"
There are a lot of factors that can help you determine whether EE is good as a long-term platform for a site, so there's no clear answer.
You have to look at ...
2
votes
Accepted
How do I limit content display based on Categories selected?
Not sure if this still works but might be worth a try:
{if "{categories}{category_name}{/categories}" != ""}
via: https://ellislab.com/forums/viewthread/136676/#673690
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 ...
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 ...
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.
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
Members only conditional
To add to Blatant's comprehensive answer and keeping native without PHP...
{if "|1|6|7|11|" *= "|".logged_in_group_id."|"} ... {/if}
Advanced Conditionals
1
vote
Accepted
Conditional for entire entries loop
You can't obviously check for just one of them out of stock numerically, so you have to concatenate them together with a key identifier, so for each loop start the total stock with a character "#", ...
1
vote
How do you conditionally embed a template based on template name?
You will need to determine which template you are on. You should be able to use {template_name} for this. Then a simple conditional will do it:
{embed="inc/.header"}
{if "{template_name}" == "...
1
vote
Accepted
If statement with a variable
All a snippet will do is place the content assigned to it before it parses the template.
So your original template will look like this:
{if {variable}} Content {/if}
Then once the snippet is parsed ...
1
vote
Accepted
How do I write a conditional based on search results?
I'm not sure I understood you, but the conditional you mentioned is:
{if !(segment_4 ~ "/^\d+$/") } the `segment_4` isn't a number{/if}
I hope it helps.
1
vote
Why is this comparison check not working on a Windows box?
This looks like a bug, to me. Probably something related to different PHP between the environments. Starting with version 2.9, EECMS changes the way conditionals are evaluated. So this bug is probably ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
advanced-conditionals × 43conditionals × 35
categories × 4
segments × 4
ifelse × 4
templates × 3
ee2 × 2
stash × 2
members × 2
playa × 2
parse-order × 2
date × 2
expresso-store × 1
channel-entries × 1
add-on × 1
relationships × 1
structure × 1
add-on-development × 1
custom-fields × 1
database × 1
url × 1
pagination × 1
javascript × 1
channel-images × 1
query × 1