21

Using quotes makes it an advanced conditional which has a different parse order than simple conditionals. This is a simple conditional. {if segment_2 == "category"} While this is parsed as an advanced conditional. {if "{segment_2}" == "category"} I think that explains why you have to put quotes around the P&T variables. Basic conditionals are parsed ...


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}


13

As I have noticed a lot, you mainly have to use quoted values when working with third party modules/plugins. I believe it has something to with the fact that not all developers call the prep_conditionals method in their code, so the values are parsed by the method that also replaces the normal tags in your template (not in conditionals). If you look at ...


11

I am not sure if i got it right but couldn't you simply wrap the conditionals in a {exp:channel:entries} tag and use the no_results to display your link? Perhaps not the most optimal way but it should get you what you want. Something like this would do... {exp:channel:entries channel="mittagskarte" limit="1" dynamic="no" disable="categories|...


10

You should put the closing </row> outside your channel entries tag, to be consistent, and use a switch statement to add the middle rows every third entry: <div class="row"> {exp:channel:entries channel="channel_name" dynamic="no"} <div class="span4"> ... </div> {switch='||</div><div ...


10

I'd recommend you taking a look at Mark Croxton's if:else and switchee plugins. They allow you to use advanced conditionals (and switches) without the overhead of having all your conditions parsed, which is the default EE behaviour. They're a fantastic way of optimising your site and I'd encourage you to start using them whenever you have a need for ...


10

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


9

Try turning off javascript protection to allow the conditionals to parse: $config['protect_javascript'] = 'n'; Also, I would wrap the channel entries tag around the conditional like so: <script type="text/javascript"> ... {exp:channel:entries channel="products" disable="member_data|pagination" limit="1"} {if add_option_on=="On"} if (thisForm.os2....


9

It seems like putting an if:else inside your simple conditional makes it an advanced conditional, thus affecting parsing order. In other words, suppose segment_1 is empty: {if segment_1 != ""} EE tags placed here won't be parsed {/if} vs. {if segment_1 != ""} EE tags placed here WILL be parsed {if segment_1 != ""} // something here {...


9

I think this should work: In this example I use three custom fields: article_image, image_description and class. {if article_image != ""} <img src="{article_image}" alt="{image_description}" title="{image_description}" class="{class}" /> {/if} You can also use the shorthand version of the above code like so "{if custom_field}content here{/if}". ...


9

You can use the search parameter. {exp:channel:entries search:image_custom_field_name="not IS_EMPTY" ...} ... {/exp:channel:entries} This will return entries where the image custom field has been filled in.


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

I'm not sure what type of variable {transcribe:language_abbreviation} is, but I presume it's an early parsed var, which could cause parsing issues. If both the LV and Transcribe var are parsed early, there's no way to control which one is parsed first in the same stage. There are 2 workarounds I can think of, assuming the Transcribe var is parsed early (...


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

Here is a FAQ on it - from the Wayback machine: http://web.archive.org/web/20101020213825/http://expressionengine.com/forums/viewthread/130537/ I link to it because there is a security factor when you have quoted and braced conditionals: 5) Are you comparing a quoted variable to a value? This is not supported and depending on the source of the variable, ...


6

You're best off using the PT Checkboxes, the native ones are just too fragile for real world use. http://devot-ee.com/add-ons/pt-field-pack Then: {if {side_content_selectables:selected option="show_feed"}} <p>show the feed</p> {/if}


6

You should try changing your conditional to test if the content is not equal to "". Also this should not be an elseif, it should simply be and else statement {exp:channel:entries channel="{segment_1}"} {matrix_primary_tag_pair} {matrix_field_1} {if matrix_field_2 != ""} {matrix_field_2} {matrix_field_3} {if:else} {...


6

By default EE prevents the advanced conditional parser from processing anything between <script> tags. Try adding this config variable: $config['protect_javascript'] = 'n';


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

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

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

Maybe something like this would work? {if '{current_time format="%U"}' > '1354296600'}{redirect='somewhere/else'}{/if} Generate the timestamp using something like http://www.onlineconversion.com/unix_time.htm


5

I'm not seeing a "{prev}" or "{next}" variable listing in the EE 2.5.3 docs for channel entries (I'm assuming you're doing this on a single-entry template). Have you tried using the {paginate}{/paginate} tag pair? (http://expressionengine.com/user_guide/modules/channel/pagination_page.html) I'm wondering if something like this will work: {exp:channel:...


5

When you put quotes around a variable/tag, the template parser first needs to parse the variables and then it will execute the conditional. Module tags/variables (what do we call them these days?) always have to be done with quotes since the template parser first needs to parse the variable/tag to find out it's value. This will force the conditional to be ...


5

This is a parse order issue. The advanced conditional gets parsed after the channel entries tag. Try something like this: {exp:channel:entries channel="my_channel" limit="15" paginate="bottom" category="{if segment_3 != "asc"}{segment_3_category_id}{/if}{if segment_4 != "desc"}{segment_3_category_id}{/if}" orderby="{if segment_3 == "desc"}woa-price{/if}{if ...


5

Generally speaking the home page can be called to ways: (1) in absence of {segment_1} or (2) when the site is using the designated primary template_group and index. Let's deal the first one first, you'd just use the conditional {if segment_1 ==""} what you want {/if} Will test for the home page. Now, if you also consider it the 'homepage' when people are ...


5

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


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