7

The dates need to be formatted properly first to compare them. Something like this: {if {business_expire_date format="%U"} < {current_time format="%U"}}class="expired"{/if} You may need to change the comparison operator < to get desired results.


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


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

The reason your code is not working is because if ExpressionEngine does not return any results, then it doesn't even parse the tags - thus {total_entries} does not even exist in that context. Also note - it is {total_results}, not {total_entries}. To help with this issue, EE has developed the {if no_results} conditional. Using that, your code should look as ...


3

OK, I feel like an idiot! Forgot about the Javascript template type. Solution: I simply created a new template, designated it as type "JavaScript", inserted my code, minus the <script> tags, then did <script src="{path="paht_to_js_template"}"></script>. Simple ;)


3

Yes, you can use group_id (or preferably logged_in_group_id) on its own - no need to include logged_in as well in the conditional.


3

There is no maximum number of if statements. The T_ENDIF error you're getting means that there's either a malformed or unclosed conditional somewhere in your code. First try removing your snippet from within the Switchee block to eliminate that, then remove/re-add your conditionals line-by-line to see exactly when the error starts.


3

You should try your code in below manner. {if ! 'portfolio|photos' *= segment_2} <h1>Conditional content.</h1> {/if} You can also try in another way also. {if segment_2 == 'portfolio' OR segment_2 == 'photos'} {if:else} <h1>Conditional content.</h1> {/if}


3

I would use this to check multiple pages: {if "page1|page2" *= segment_2} active {/if}


2

There are a several ways really. You could use regular PHP: $categories = "{segment_5}"; $category = explode("-", $categories); echo "category 1 = $category[0]"; // 5 echo "Category 2 = $category[1]"; // 6 But beware of parse order when integrating with PHP tags. Alternative you could always have some string fun. You can take advantage of the full ...


2

the following template will generate an error because neither the "foo" or "bar" module or plugin exist. Nested simple conditionals The "foo" error will not show up, because the two nested conditionals are both simple conditionals. Advanced conditional The second block has a nested advanced conditional (it tests for two conditionals, last_segment AND ...


2

I saw you already find a solution, but I think you should know the reason your code wasn't working. Your conditional will never work... Ooops! Please, forgive me. Your conditional will always work because "product1" != "product2". This code will always evaluate: {if segment_3!="product1" OR segment_3!="product2"} <img src="/images/styles/madeinusa....


2

You problem is you're trying to do a complex conditional within the tag parameters, that's not possible. Here's a good article regarding parsing conditionals within tags: http://johndwells.com/blog/expressionengine-parse-order-advanced-conditionals-as-tag-parameters As you state, the problem is simple conditionals versus complex conditionals. The problem ...


2

you can use: {parents orderby="date" sort="desc" channel="articles" category="1" status="not closed"} {if parents:count == "1"}<h3>ARTICLES</h3>{/if} <h4><a href="{parents:title_permalink=">{parents:title}</a></h4> <h5>{parents:article_author}</h5> {if parents:no_results}{/if} {/parents} Regard's.


2

The real value/power of EE is in the control panel, and how quickly you can pull together complex data-driven sites by not having to build an admin interface. I'm currently building a mobile app that uses a combination of Meteor and EE, and the real reason I opted for EE as a back-end solution is because it would save weeks of work using what EE does ...


2

It's really a matter of "it depends" There are a lot of factors that can help you determine whether EE is good as a long-term platform for a site, so there's no clear answer. You have to look at what you expect your architecture to be like and determine how much bending of EE it will take to make it work. In some cases, it works just perfectly, in others, ...


2

Not sure if this still works but might be worth a try: {if "{categories}{category_name}{/categories}" != ""} via: https://ellislab.com/forums/viewthread/136676/#673690


2

See if wrapping segment_3 in matching quotes and curly brackets helps. I think I remember stumbling upon that issue in my early EE days and it dealing with parse order; keeping it matching helped in my case and was something I got in the habit of doing. I believe with EE 2.9+ they recommend not to put quotes around variables as they've updated the template ...


1

To add to Blatant's comprehensive answer and keeping native without PHP... {if "|1|6|7|11|" *= "|".logged_in_group_id."|"} ... {/if} Advanced Conditionals


1

You can't obviously check for just one of them out of stock numerically, so you have to concatenate them together with a key identifier, so for each loop start the total stock with a character "#", then if "#0" exists, you know that one of the items is out (albeit you won't know which). So assuming product A has 5, Product B has 0 and Product C has 2, your ...


1

You will need to determine which template you are on. You should be able to use {template_name} for this. Then a simple conditional will do it: {embed="inc/.header"} {if "{template_name}" == "page_visit"} {embed="inc/.map-code"} {/if} You could also pass the template name on to .header, like so: {embed="inc/.header" my_template_name = "{template_name}...


1

All a snippet will do is place the content assigned to it before it parses the template. So your original template will look like this: {if {variable}} Content {/if} Then once the snippet is parsed it will look like this: {if logged_in AND member_group == "1" OR member_group == "2" OR member_group == "3"} Content {/if} Then it will parse the template ...


1

I'm not sure I understood you, but the conditional you mentioned is: {if !(segment_4 ~ "/^\d+$/") } the `segment_4` isn't a number{/if} I hope it helps.


1

I have a solution below for you so what I have done is test 3 things 1.) If there is more than 1 image do the gallery code only displaying the div html if the gallery exists so the first time it outputs the opening div the last image in the loop outputs the closing div. 2.) If there is only 1 image I have you a space to do other code. 3.) If there aren't ...


1

I'm not exactly sure on the full context but the problem could very well be the quotation marks around the 0. If you're comparing against a number then you don't need quotation marks as that will convert it to a string and will never match: {if {exp:playa:total_parents channel='listing'} > 0} If that doesn't work then you can probably simplify things a ...


1

First to make it clear did u use it in {channel:entries} loop if not you should , and if you want to use it outside {channel:entries} loop you must add entry_id param I am test your code on my localhost and it's work fine. I hope this will help you. Regard's.


1

This looks like a bug, to me. Probably something related to different PHP between the environments. Starting with version 2.9, EECMS changes the way conditionals are evaluated. So this bug is probably gone. Conditionals should always use the syntax: {if current_path == "/"} ... {/if} But {current_path} is parsed at the end of parsing stages. This ...


1

If it did work it would output "more than one" 5 times. I'd use count instead, like this: {if count==2}More than one{/if} There's this is interesting article over at ellislabs from some years back but still relevant.


1

Your layout may have to change because EE doesn't yet know if the title is inside the category. If you can transfer the conditional inside the entry_titles you may have better luck. {entry_titles} {if segment_x == {url_title}}do something{/if} {/entry_titles} EE category stuff can be a pita and I've often used gwCode categories. You do get more flexibility ...


1

I'm no Mark Croxton, but I'd bet this has to do with the parsing order of the Stash variable you are setting inside the column 1 advanced conditionals. You need to make sure that column 2 isn't parsed until column 1 is fully parsed, so that those variables are set prior to column 2's IfElse running. In my understanding, the best way to do that would be make ...


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