17

The solution turns out to be fairly simple and the logic can pretty much work the same. EE relationship fields let you pull the count separately from the tag pair like this: {relationship-field:count} So, the solution is to use that in our conditional logic: {if "{relationship-field:count}" == ""} do stuff {if:else} do relationship stuff {/if}


10

Long time to add to this but... {relationship-field} do relationship stuff {if relationship-field:no_results} Empty stuuf {/if} {/relationship-field}


9

I was able to accomplish what I was after using the following... {if "{categories}{category_url_title}{/categories}"!=""} CATEGORY EXISTS {if:else} NO CATEGORY EXISTS {/if}


6

Member defined variables like {member_group} are parsed last by default, so your advanced (not simple) conditionals will never properly read the member data. View parse order pdf by Low. You need to install an add-on to move the parsing of the member defined variables earlier. Try Low Variables, Mo' Variables, or any other add-on that has this feature.


6

First off, you can't have any "else" statements in your conditional or it will be considered "advanced". But more importantly in relation to how you're writing these: Simple Conditionals aren't just about the operators, control structures & variables, but the format is actually critical. The actual format must be: {if early_parsed_variable == "string"}...


6

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 class="avatar wo-alt" alt="{title}" src="{url}" /> {/if} {/right_image_1} </li>


5

To a conditional to be considered a simple one, it needs to use snippets or early parsed variables. This isn't the case when you're using freebie. Unlike Low Seg2cat, that parses really earlier on parsing stages, Freebie parses together with all modules. Can you remove freebie? If you can, try this: <section class="blog-listing"> {if segment_X == ...


5

Well, you're having an HTML issue, not an EECMS issue, because an element can't have more than oneclass attribute. Use this: <li class="{if segment_1 == "donate"}active {/if}dropdown">Donate</li> Or you can simple remove the dropdown class and use a child selector or a descendant selector. Even for JavaScript, you don't need this class. You ...


5

Or set a $env_global['myjs'] in the config.prod.php with the analytics code ID number and leave that var blank in the config.dev.php then just {myjs} in the template and it only outputs the ID in production.


5

The following conditional will achieve what you want: {if {current_time format="%m"} <= 6} <p>do Jan through June</p> {if:else} <p>do July through December</p> {/if} Edit: Replying to request for March-thru-September date range: Since the %m flag on the date format represents each month as a number (and conveniently one-...


5

EE simply removes any tags corresponding to custom fields that have no data. So by the time EE is ready to parse the outer {if} conditional, it will look like this: {if > 0} Try wrapping the field tag in quotes: {if '{tech_documents:total_rows search:doc_thumb="IS_EMPTY"}' > 0}


4

This is easily accomplished using the start_on parameter. If the start_on date/time should be current time use: {exp:channel:entries channel="events" limit="3" sort="asc" start_on="{current_time format='%Y-%m-%d %H:%i'}" show_future_entries="yes" } If the start_on date/time should be dynamic, enable PHP in the template and set it ...


4

Perhaps there is a more elegant way, but this works: {article_images} {if total_rows > "1" && row_count == "1"} <div id='news_slider'> {/if} <img title="{img_title}" src="{img}" /> {if total_rows > "1" && row_count == total_rows} </div> {/if} {/article_images}


4

This way is not possible because of ExpressionEngine’s Parse Order Parse advanced conditionals Process embedded templates With your code you don't have "yes" in conditionals when EE parses it, you have "{embed="test/foo"}"


4

If submenu is the grid fieldtype name, then all you need is: {if submenu:total_rows > 0}submenu contents{/if} You may need to add quotes and brackets around the condition if the above doesn't work


4

TL;DR: Use AND in your second conditional. Actually, it is working as expected. In the first conditional, you're saying if x is a or x is b, which will return true if x is a or b. The second conditional says if x is not a or x is not b, which will return true if x is a or b, as x cannot be both. Simple logic. I take it you want the second conditional to be ...


4

Your problem is parse order, and there may be several workarounds for that... however, (and I'm guessing a bit at what you're trying to do) I would suggest that instead of using this unusual exp:config_variables add-on and faffing about with parse order that you use the assign_to_config array to create your own early-parsed global variables. Then you can do ...


4

I think GWcode Categories would be the easiest way to do this: http://gwcode.com/add-ons/gwcode-categories. It can also do a great number of other things with categories. There's also an add-on just for counting category entries: http://devot-ee.com/add-ons/category-count I actually use both on my site. I don't think there is a native way to do this ...


4

Try using the count and total results variables, but namespaced with the name of your relationship field: {relationship_field} {if relationship_field:count ==1} <ol> {/if} <li>{relationship_field:title}</li> {if relationship_field:count == relationship_field:total_results} </ol> {/if} {/...


4

I believe if you use: {If your_field} something exists {/if} This should display conditional content if the field contains anything at all.


4

Put the div tags inside your channel entries tag pair but to prevent them being output many times wrap them in conditionals. Then you can test the total results returned to decide whether to output your tab. {exp:channel:entries channel="thing" search:thing_status="approved"} {if count==1} <ul id="tabs"> {if total_results>0}&...


4

Try this: <h3> {if long_titles} {long_titles} {if:else} {title} {/if} </h3>


4

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" the_start_date="{entry_date}" the_entry_id="{entry_id}"} {/exp:channel:entries} Your embed would look something like this: {exp:channel:entries start_on="{embed:...


4

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 not equal to "portfolio" neither equal to "photos" use this condition: {if segment_2 != "portfolio" && segment_2 != "photos"} <p>Conditional ...


3

You are doing a ton in your template. After a quick look I'd say your slowness is related to your relationship fields. I suggest installing the EE Debug Tool to determine what specifically is "slow" on the page load. That will help you decide how to optimize the template. I also suggest taking a look at CE Cache to see if it makes sense for your project.


3

If you look at the documentation a bit more carefully, you'll see that the {case value="xxx"} tags only use a single = sign. So, this should work {exp:switchee variable = "{champions}" parse="inward"} {case value="team 3"} <p>team 3</p> {/case} {/exp:switchee}


3

The error happens because, sometimes, the conditionals brakes after a stage of parsing. Example: {if {x} != ""} If, x is empty, the conditional will be turned into: {if != ""} Which doesn't make sense. So, you can use: {if "{x}" != ""} Or the what the Template Class calls "short conditionals": {if x} I suggest you to try: {if "{...


3

Not a solution to your specific question, but a solution to your general problem (how to display only upcoming events): This is exactly why I wrote EEvent Helper years ago. The idea is that you set events to expire at the end of their event date, allowing you to easily pull just past events, or just upcoming events. {!-- Upcoming Events --} {exp:channel:...


3

php (PHP Parsing Stage: ouput) {exp:channel:entries channel="courses" category="2"} <?php $excludefrom = '|{categories}{category_id}|{/categories}'; ?> <?php if (substr_count($excludefrom, "|2|") == 0){?> {course_start-date format='%d %M %Y'} <?php } ?> {/exp:channel:entries} (you can do the same using Switchee the same way ...


3

To expound on my comment to this answer, and I acknowledge this is a bit unorthodox, this solution will improve performance by only executing one channel entries tag. The query tag will fetch the entry IDs, and dynamically build an embed variable that we will use on a single channel entries tag for this page request. {exp:query sql="SELECT entry_id FROM ...


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