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}


7

...And as soon as I write it down in a question, I figured out my mistake. Correct solution for future visitors was: {if "{product_videos:total_children}" > 0} //do something {/if}


6

So yeah. Parse order. I take it you've seen this pdf. If not, take a look, study it well. What you need is for the opening tag to be in order before you hit stage 5: the parsing of module/plugin tags. In order to do that, you can only use simple conditionals in combination with early parsed global variables and preload replace variables. Native early parsed ...


6

After some help from the wonderful Mr. Croxton I was able to sort it out. Here is how to pull this off. When grabbing the data in your model you need to stash the {entry_id} of the parent list (I call mine {e_id} for no real reason). Then, when setting the nested list, provide context with the {entry_id} by using name="employees_{entry_id}". {exp:stash:...


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

You can use {if banner_matrix_field:total_rows >= 1} graphic{/if} Matrix docs link


5

The documentation is confusing on the EL site. If you prefix the single tags variables count & total_results with the custom field name, you will have access to control your markup with conditionals. This should work: {cf_article_related} {if cf_article_related:count == 1} <aside> <h2>Further Reading</h2> &...


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

Robert! First of all, let's fix your conditionals. Conditionals using numbers don't need quotation marks. From docs: If you are testing against a word, you should enclose the word in single or double-quotes. If you are testing against a number, then you do not need to use quotes. So: {if category_id == 100} Even so, this code doesn't work because {...


4

This looks like a bug on the no_results conditional, to me. May I suggest you something? Let's change your approach to this. Look at the docs. You should take advantage of the parsing order and do not let your code run if you can avoid. So, use simple conditionals around the channel:entries variable pair. This way, in the two first situations, the parsing ...


4

To be on the safe side, I'd check for numerical values only, like 201308. Something like this: {if {event_dates:start_date format="%Y%m"} == {event_dates:end_date format="%Y%m"}} same month {if:else} not same month {/if} When debugging the advanced conditionals, try to remove them and add them one at a time to see which actual one is causing the ...


4

I'd recommend trying class="{if '{social_links:network}' == 'Google'}google{/if}" Whatever you use for the conditional, if you match up the quotes usage (double versus single), it makes a big difference.


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}&...


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