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

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

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


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

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 ;)


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

If you are using EE5 then one solution would be to use a Fluid field. Set up the Fluid field to allow the user to pick one of three fields (one for each of your cases) and then in your template you can set it up to use the appropriate HTML depending on which of the defined Fluid field types the user chose. It is pretty easy to do, and gives you much more ...


1

You can try below code. {if segment_2 == "page1" || segment_2 == "page2"} nav-expanded nav-active {/if} I hope this will works for you.


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 could do this with an embed by setting your embed with the author_id or author_name as a variable. {embed="templategroup/templatename" authorName="{author_name}"} embed: {exp:channel:entries channel="authors" search:author_name="={embed:authorName}" However, if the blog post and the author channel info have the same author, it would be much simpler ...


1

You can use a conditional with {site_id} or {site_short_name}. If you still want to set the condition based upon on the domain, you can use {site_url}.


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


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