Questions tagged [ifelse]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
26
votes
7answers
6k views

Difference between quoted and unquoted comparison syntax

In general, when comparing variables in templates, I use unquoted variable names. e.g., {if segment_3 == category_url_title} If comparing to an actual value (not a variable), I quote the value. e.g.,...
4
votes
2answers
3k views

Return message: if no results

I am trying to do something which I suspect is quite simple. I am referencing a channel field to rerun results to populate a series of check boxes. If there are no results I wish to say 'There are no ...
4
votes
3answers
292 views

If statement inside a loop?

I am using the store finder module, and am trying to insert a "title" for each "state". If I have 20 stores in a certain state, I would only like to display the "title" once. Is there any way this ...
4
votes
2answers
3k views

What is wrong with this IF/ELSE conditional?

On events pages that meet the first conditional statement (first segment is 'events' and second segment is 'not empty') the image parses as expected. However, when the first segment is 'member-...
3
votes
2answers
1k views

PHP Syntax Error from ExpressionEngine Template

Here's some code I'm using to generate Breadcrumbs on my site. Unfortunately the client has quite specific requirements in terms of URLs, so I've had to play around with Crumbly's tag a little using ...
3
votes
2answers
396 views

Stash set_list not displaying channel entry loop

I'm having trouble displaying a channel entry loop within my EE setup which uses the Stash and IfElse modules. First of all, see this screenshot of my file structure: I'm using the 'partials approach'...
2
votes
3answers
179 views

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

So, I think I've caught on that advanced conditions and EE tags don't play like expected. So, I downloaded Mark C's "IfElse" plugin and things are looking up. However, my default condition, doesn'...
2
votes
1answer
154 views

Wrapping a query in a logic statement

I didn't think this would give me any trouble, but it is. I just want to run a query depending on the URL segments. I have this now: {if segment_3 != ''} {exp:query sql="SELECT a....
2
votes
1answer
108 views

Affecting the last Category in a list

I have this code: {categories}{category_name}, {/categories} Outputting in a Entries Tag Pair. I would like to remove the comma from the last outputted category only. I am thinking an IF ...
2
votes
1answer
141 views

Limit entry using status and categories

I have a "featured item" part on my site that is controlled with a new status i created called "featured". I have 8 parent categories, and would like to have 8 different featured items, 1 unique for ...
2
votes
2answers
68 views

How to only execute some code within a specific time frame?

I have a site where users can use a SafeCracker form to submit an entry. Once they submit the entry, they are taken to a confirmation page that also includes some code to automatically send out a ...
2
votes
1answer
150 views

If statement on segment eq url_title - strange behavior

My goal was to mark current/active article on the list. Code looks like: <ul class="list-plain"> {exp:channel:entries channel="products" category="{segment_3_category_id}" orderby="title" sort="...
2
votes
1answer
50 views

'If' conditional statement not working, returning PHP error

I am using EE v2.5 and following the documentation from https://docs.expressionengine.com/v2/templates/conditionals.html I am trying to create an If Statement where if the Channel field labelled '...
2
votes
1answer
56 views

How To Create Headers For A List

I have a list of items. Each item has a season. I am trying to organize the items by season. I believe the list is pre sorted and I need to create a header everytime there item has a new season In ...
1
vote
7answers
488 views

If conditional using category selections

Is there a way of saying If a category contains two selections, display this CSS If a category contains one selection display this CSS instead. I can't seem to find the right formula of {if} ...
1
vote
1answer
51 views

Conditional if else Problem

I have an additional title called {long_titles}, but do not use it for every entry. However, when I do use it, I want to suppress the {title}. I have tried several approaches but can't get it. Needs ...
1
vote
2answers
291 views

Conditional Plugins: Switchee & IfElse

I have some simple conditionals mixed with some advanced conditionals. I've just downloaded Switchee and IfElse and am trying to figure out which plugin is best for each situation. Can someone help ...
1
vote
1answer
30 views

changing permissions on certain categories

I have a page that hides some amount of page content for free viewers. We have a certain category of 'sample' articles which should be available for everyone. Is there an if clause which basically ...
1
vote
2answers
55 views

How to check if EE member has a website address (field carries http:// so it always returns true )

I have the following code: {if url} <p><strong>Website</strong><br /> <a target="_blank" href="{url}">{company_name}</a></p> <hr /> {/if} ...
1
vote
2answers
73 views

If statement parentheses not working correctly

I've got a weird issue with parentheses in an if statement. If I have the if statement on it's own then no content is shown. If, however, I place two if statements in front of it then everything works ...
1
vote
3answers
41 views

detect data is coming from which channel?

{exp:channel:entries channel="schedule_action | schedule_sports | schedule_hd" } //how do i detect channel here.I need to use a if condition. {/exp:channel:entries} ...
1
vote
2answers
163 views

if 2 channels on one page ie: if channel == “channel1”

I am trying to display one entry (most recent) on my home page from 2 different channels. So ChannelA and ChannelB. {exp:weblog:entries weblog="weblogA|weblogB" limit="1" sort="asc" ...
1
vote
2answers
612 views

if:else not working with my matrix tag pair

Maybe I am a moron, but i just can't get this to work. Iv anyone can help me... please do so before i start hurting myself... :p I'm working with EE 2.5.5 and Matrix 2.5.2. I've got a channel called ...
1
vote
2answers
396 views

If Page is not home page [duplicate]

I have a separate navigation that I want displayed on all pages that are not the home page. I thought something link this would work but not quite: {if segment_1} {if:else} <nav class="main-nav"&...
1
vote
1answer
120 views

If condition for phpstringfun or streng?

I want to find if a string contains a word ot not? It is a pretty simple thing if i want to do it in php.But When it comes to EE you need some plugins to do the job of strpos. I have two plugins ...
1
vote
1answer
315 views

Syntax error, unexpected T_ENDIF

I have the following code in my templates: {exp:channel:entries channel="cover" limit="5"} {if total_results > 1}More than one{/if} {covervid_bg_video limit="1"}{file:url}{/...
1
vote
1answer
250 views

Condition if entries exist?

My markup: <section id="box"> <ul id="slide"> <li></li> <li></li> <li></li> </ul> </section> I want to show the section box only if date ...
1
vote
1answer
108 views

Compare contents of two grid inputs, possibly with variables?

I have two grid inputs and I need to have a conditional statement that says: if all fields of both grids are equal to 0, output some text. The way I'm trying to do this is by changing a variable value ...
1
vote
1answer
67 views

Playa fields: can I pair one channel entry to another and populate similar channel fields in template?

I'm an EE novice working on a big site. I have a configuration concept in my head and I want to know if it's doable. Please bear with my limited knowledge of EE lingo. I'm still learning. So I have a ...
1
vote
1answer
1k views

Using OR in an if statement

I have this code: {if segment_1 != "slug1" || segment_1 != "slug2"}<h2>Text</h2>{/if} For some reason this does not work with the second instruction after the OR operator. If I remove ...
1
vote
3answers
149 views

Setting a Stash variable within an old style EE conditional

I'm working on an old EE site (v2.5.2) which for reasons I won't go into I cannot update to a newer version. I am trying to set a Stash variable based on whether or not a condition evaluates to true. ...
1
vote
0answers
69 views

List entries grouped by field value and category

I have a channel (products) where each entry has only one category. Each entry also has a custom field (year) which stores a year value (e.g. 2015). The output I currently have looks like this (note ...
1
vote
2answers
309 views

If statement based on length of Channel Field

Is it possible to create an {if} statement based on the character length of a channel field? Something along the lines of this: Lets say I have the channel field - {title} and I want to add a class ...
1
vote
0answers
62 views

How deep into a Matrix field type can I go with IF statements?

Bear with me as I explain my setup... I have a channel called Speaker and a channel field called speaker_media that is a matrix field type. Inside the matrix I have a channel field for speaker_audio, ...
0
votes
1answer
115 views

If not conditional not behaving as expected (== works, != doesn't)

I'm using DevDemon Forms, on two of my pages, which requires that jquery be included in the the document head. On other pages however, I want to include jquery in the footer. So i thought I would ...
0
votes
2answers
140 views

What is the Wildcard for expression engine?

I am trying to use the wildcard for my {if} statement. Where I could have P12,P24,P36,48, etc. {if segment_4 !="" && segment_4 !="P*"} But The wildcard is not working for me, does the ...
0
votes
1answer
622 views

category id with if:else statement

Basically im looking to show alternate images depending on the category id. Below I have shown my code, which doesnt work, but I would appreciate any information that any one could give me please! ...
0
votes
2answers
78 views

Is this a parsing issue with advanced conditionals?

I have a header snippet that includes a "Made in USA" image on it. Well the client now wants the image removed on a couple product pages. I setup an advanced conditional to check for those pages using ...
0
votes
1answer
33 views

Checking the channel in the channel entries tag

What I am trying to do is combine the output of 2 channels. They both have an image with a different name so I am trying to check the channel to determine the which image I need to output. Code below. ...
0
votes
2answers
67 views

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

I get an error message each time. "You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}." Stuck ...
0
votes
2answers
157 views

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

Within a loop, I need to output different info according to whether an entry is in an array of id's or not. I currently get the id's from a query on the matrix table. So I need something like this: ...
0
votes
1answer
71 views

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

Channels and Fields Summary: Tours channel - stores a list of all Vacations the site offers tour_specials field - a Playa field, linked to the Specials channel indicating which Special Offers apply ...
0
votes
1answer
47 views

Conditional statement issues

EE v2.4.0 (Updating is not an option at this time) Hello! The photo gallery that we use still shows up even when no photos are added. Basically what I'm trying to do is get the image gallery to show ...
0
votes
2answers
78 views

Is there a layout switcher in EE2?

Ok so I have this dreamweaver extension called tab panel menu where each menu I can generate either a single column, 2 column, 3 column, 4 column, 5 column or sub menu. Now I wish to make use of this ...
0
votes
1answer
60 views

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

In the new EE version (2.9), the conditionals evaluate when ready, so the performances are boosted. Is still necessary using the IfElse Add-on from Mark Croxton, when using EE conditional?
0
votes
1answer
961 views

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

I am trying to set up a slider in ExpressionEngine which will display a video if the video embed code exists, otherwise it will display an image slider. Currently, I am not able to hide the image ...
0
votes
1answer
74 views

Wygwam if conditional

Basically i want to know if its possible for expression engines if tag to check if a wygwam field contains images. I know its possible to pull through just images like so: {my_wygwam_field ...
0
votes
1answer
47 views

'IF' Conditional Not Working

I want to set up a conditional that when correctly running will post a 'widget' on the sidebar based on the entry. I have eight events (concerts) and three venues. On the individual detail page, I ...
0
votes
1answer
23 views

Conditional with if and ifelse not working

Every entry has one image {event_feature_image_01}, however, some entries have a second, third and forth image. I want to count backwards from the forth image {event_feature_image_04}. Every entry has ...
0
votes
1answer
110 views

EE 2.5.5 how to use snippet in if statement

I have a multi site EE set up and I have set up a snippet to use in my template. The snippet syntax is {current_site_name} and the content that the snippet outputs is {site_name} I am trying to use ...