Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

For questions that use logic to display or hide parts of a page/template

0
votes
0answers
4 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 '...
0
votes
3answers
18 views

Matching more than one segment

Matching one URL segments always works fine but is possible to match more than one? For example this works: {if segment_2 == "page"}nav-expanded nav-active{/if} But this does not: {if segment_2 == ...
2
votes
1answer
20 views

EE3 - When image description is blank, use title field

I'm running into a roadblock here. Basically my client wants to use the "description" field of a file as the alt text, unless it isn't filled out, then he wants it to fall back to the page title. I am ...
0
votes
1answer
19 views

Visitor (from DevDemon) - How to logout upon conditionals?

I'm using Visitor (for EE v3) and would like to know if there is a way to use the {exp:visitor:logout return="/mytemplategroup/mytemplate"} within conditionals? Because the tag is triggered as soon ...
0
votes
0answers
75 views

Cookie setting within a conditional not working as expected

{if "{exp:cookie:get name='test'}" == ''} {exp:cookie:set name="test" value="a" expire="1209600"} Here1 {if:else} {exp:cookie:set name="test" value="b" expire="1209600"} Here2 {/if} ...
0
votes
1answer
20 views

{order_total} conditional {if order_total > 100}

I want to offer manual payment option only if cart total amount is above 100,00 but {if order_total > 100} doesnt seem to work. Any sugestions anyone?
2
votes
1answer
35 views

How to detect an AJAX request in a EE4 template?

What's the best practive to detect an AJAX request in EE4 without activating PHP in the template? With the previous version of EE, I used the Ajax Detect Conditional ({if ajax}, {if not_ajax}) from ...
0
votes
1answer
18 views

Conditional Not Working as Expected.

I have a series of performance dates; let's say 5. {performance_date_one format="%l, %F %j, %Y; %g:%i %a"} However, after a date has passed, I want to gray the date out and remove the link, but ...
1
vote
3answers
52 views

Why is the OR not working in a conditional statement?

Running EE 3.5.15 I am trying to show content based on URL segment and the following is not working correctly: {if "{segment_2}" != "portfolio" || "{segment_2}" != "photos"} <p>Conditional ...
1
vote
1answer
39 views

Checking if date field variables exist in templates

I'm having a strange issue where I can't seem to determine whether a standard date field in EE2 contains data. For the date variable {birth_date}: {if birth_date} Do stuff {/if} In my code, this ...
1
vote
1answer
35 views

Problem with category conditional

I always seem to run into some problems with conditionals. The code in question is this: {categories} {if category_id != "305|325"} Index version 1 {/if} {if category_id == "305|325"} Index ...
0
votes
1answer
58 views

conditional statement with radio button value

I'm not sure if this is an EE bug or if I'm doing something wrong. I'm looping through my "tournaments" channel entries and for each entry I'm looping through a "teams" channel that has a ...
1
vote
1answer
79 views

Conditional on select dropdown field type not working

I have a select dropdown field with 2 values "yes" and "no". I want to display an entry when the "yes" is selected. Ive done this many times before but now I can't get it to go. It shows just one ...
0
votes
1answer
42 views

Show different content based on url segement

Sorry if my title is a little confusing. Here is my dilemma... I have a product category page with different products. I'm trying to figure out a way to say {if segment_3} show the product specific ...
0
votes
1answer
18 views

Conditional. Prioritize one field over another if both exist

Cannot seem to work this out! I have two fields, one is an image {e_image} and the other is plain text {e_map}. Both of these display a div in the exact same spot. What I want, is if an image is ...
0
votes
1answer
42 views

Grid Conditionals - side by side fields - only display if field filled

Perplexed how or if this can be achieved. I have a grid field e_contact that consists of three field/columns: Name   Phone   Email {ename}   {ephone}   {eemail} My code ...
0
votes
1answer
33 views

Conditional with “&” in comaprison string fails

EE 2.9.2, Structure 3.3.17 In running a conditional to compare a page title and it's Structure parent, the conditional returns false if there is "&" or any other punctuation in the string. {if ...
3
votes
2answers
110 views

Showing Expired Entries Only. Not working

I want to show previous concerts (past concerts) under a special tab. I only want to show past concerts, not current or upcoming concerts that is under a different tab. I tried the following code. ...
4
votes
1answer
45 views

EE: Show previous 3 blog entries prior to the current viewed entry

I have been stuck on this one for a few days now: Page Content: Main blog post (current entry) + a sidebar displaying the previous 3 blog entries Sidebar Code: {exp:channel:entries channel="blog" ...
3
votes
3answers
62 views

Need a Conditional for Tally

I'm using the Tally add-on to display a total from a custom field I have that stores numeric values. It's working great, my only problem is that I need a conditional setup that will display 'your ...
0
votes
1answer
44 views

Conditional statement using two different channels

I have two channels setup, one "blog" and one "authors". The blog channel has all of the blog post entries and the Authors channel has a list of the different post authors. I am looking on a ...
0
votes
1answer
49 views

How do I make content conditional on domain name?

I am wrapping up an MSM build that has one domain and three subdomains. Each site has unique Analytics code. Conditional code based on segment is very useful but I am not sure how to display ...
0
votes
1answer
38 views

Conditional with categories

So I'm trying to conditionally display an embed within an entry based on several parameters: channel_short_name and category. So I have a conditional that checks a few items and then if it matches has ...
0
votes
1answer
43 views

Displaying Channel Form based on member group, number of entries/channel within a date range

I am trying to run a conditional which displays a "can't post" message if the member of a group_id 1 had previously posted 2 entries in a channel. Otherwise, it displays a channel form to post an ...
0
votes
1answer
34 views

Q re: nested conditional with grid rows

I've got a Grid field (EE2.11) where one of the columns is called "Open?" with a checkbox for "Closed" so I can turn a row off and on. I'm using a nested conditional to first filter out anything that'...
1
vote
3answers
82 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. ...
0
votes
1answer
28 views

Conditional within solspace calendar tag

I am encountering a strange (to me, but maybe I'm missing something) bug when attempting to use conditionals to distinguish between users in the Solspace Calendar tag. As you can see from the code ...
0
votes
1answer
40 views

Limit conditional results inside of channel entry

I have a channel entry that I want to display limited results and also only show results with a certain conditional applied to it. Right now I am opening the channel entry and setting a limit inside ...
1
vote
1answer
27 views

modulo inside stash list

I have a stash list for displaying entries. In general a row has 3 columns, but I also want to break with rows of 2 columns. layout looks like: 30%|30%|30% 30%|30%|30% 50%|50% 30%|30%|30% 30%|30%|30%...
0
votes
1answer
36 views

Stash parse categories and category_id

I'm trying to use the following conditionals in exp:stash:parse to set some values based on the category_id. However, I just can't get it to work and it always just gold for channel_colour or 20 for ...
0
votes
1answer
63 views

Date conditional for over test if over 2 years

Haven't used EE in a while and having a brain freeze on best way to do a date conditional. I have a date custom field for a DOB. I want to conditional show items if the person/child is over 2 years ...
0
votes
1answer
78 views

Does EE3 support preload-replace with conditionals in grid fields?

I keep running into issues using preload-replace with conditionals that are in a grid field. I have the preload: {preload_replace:staticchannelslug="gp"} And am trying to use it like so: {...
1
vote
1answer
41 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 ...
0
votes
2answers
30 views

Logged out redirect not working for cartthrob:add_to_cart tag

I have add to cart buttons like this: <a href="{entry_id_path='weekend-courses/add-to-cart'}" >Book now</a> 'weekend-courses/add-to-cart' contains only this: {if logged_out} {redirect=...
0
votes
2answers
41 views

404 Redirect when there are too many segments

Having some issues forcing a 404 redirect when there are too many segments. Here is the page I am working on http://syntropy.highimpact.com/case-studies/aurora-flight-sciences/ I'm using the ...
0
votes
3answers
28 views

display last 6 entries in a channel

Have events channel have 10 entries (the channel can have varying range of entries for example it has 10) have a date field called event_start_date ex. current date is 2016-05-30 Desire - ...
0
votes
1answer
33 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
2answers
70 views

conditional statment to display all entries that are from today and forward

Have events channel have 10 entries have a date field called event_start_date Desire - display only up coming events in asc order List 2016-12-06 2016-11-01 2016-10-24 2016-05-30 2016-09-12 2016-...
0
votes
1answer
50 views

Conditional statement error inside relationship field

I have a relationship problem and I figured Stack Exchange can help ;) I'm using the standard relationship field in EE 2.8.1 but the conditional statement just keeps throwing an error; {...
0
votes
1answer
36 views

if statements that can alter a layout

Im working on a project where there are two divs next too each other (not worried about the styling for now) but my question is the following. div 1 | div 2 if there's no channels fields in div ...
0
votes
2answers
20 views

Template that detect if an entry has “All Categories” and then if “Any Categories”

I have a series of entries in a channel called "Messages" that need to appear in different ways according to if ALL categories have been assigned, or if less than all have been assigned. The most ...
0
votes
1answer
30 views

Why doesn't navigation conditional work?

I am working on a sidebar navigation here. The navigation works correctly but I am trying to highlight the active entry. In the past I have been able to use a segment_3 conditional to tag the active ...
0
votes
1answer
39 views

conditional if statements for channel fields

Im running into a bit of a problem, i have two channels which are called on a single page, displaying the latest entries from each. these two channels have different fields setup for descriptions ...
0
votes
2answers
44 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
1answer
18 views

RSS feed from 2.1.4 no longer works with conditionals in 3.2.0

We just upgraded to 3.2.0 from 2.1.4, and the move seems to have broken my RSS feeds completely. I used several conditionals to assign the correct paths to each template group section, but none of ...
0
votes
2answers
42 views

Can't get Grid conditionals to work in 2.10.3

I've been trying to get a Grid conditional to work (using EE2.10.3) and no matter what I try, it's not working and the page crashes. My grid field is called "projects_video" and I want to output ...
0
votes
1answer
20 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
2answers
46 views

Members only conditional

Is there a better way to write this? {if logged_in_group_id == "1" || logged_in_group_id == "6" || logged_in_group_id == "7" || logged_in_group_id == "11"} Hello Members... {/if} It seems very long. ...
0
votes
2answers
91 views

Category Conditional

This works fine but I want to “limit” the number of times the snippet shows up at the top of each entry, I only want it to show up on the top (one time in category “7”, no mater haw many entries. ...
0
votes
1answer
35 views

{member_group} not working in conditional

I have the following code: {exp:member:custom_profile_data} <div class="profile"> {member_group} {if member_group == "Super Admins"}You are a Super Admin{/if} ...