People who code: we want your input. Take the Survey

Hot answers tagged

5

This happens because of the "else". If you use else, the conditional became advanced and it will be parsed after the modules. Try this: {if segment_3 != ''} {exp:query sql="SELECT a.cat_id, a.parent_id, b.cat_name FROM exp_categories a, exp_categories b WHERE a.cat_url_title = '{segment_3}' AND b.cat_url_title = '{segment_2}'"} {/if} {if segment_3 ==''} ...


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

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


3

There are no wildcards in EE. You're probably looking for something like Switchee, where you can use regular expression matching, or Mo Variables, which gives you {if paginated}, which could help here.


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

For a solution for now, how about a different conditional? {if "{url}" != "http://"} <p><strong>Website</strong><br /> <a target="_blank" href="{url}">{company_name}</a></p> <hr /> {/if}


3

This is what you will need to do. {exp:channel:categories style="linear"} {if "{category_id}" == "70"} <figure> <a href="#"> {if ...


3

Not exactly, but you could put your Channel Entries tag into an embedded template, and use a member group ID conditional to send it the parameters you want based on the visitors membership status. {if logged_in_group_id == 7} {embed="template_group/_template_name" categories="1|2|3|4"} {if:else} {embed="template_group/_template_name" categories="1"} ...


2

In main-landing.html wrap the stash:set pair around the entries tag pair. {stash:embed:layouts:support-main-landing} {!-- Set data for the landing page --} {exp:stash:set parse_tags="yes"} {exp:channel:entries channel="support" url_title="{segment_3}"} {stash:url_title}{url_title}{/stash:url_title} {stash:title}{title}{/stash:title} ...


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 can try MX Calc {exp:mx_calc expression="{current_time} - 600 "} {if entry_date > {calc_result}} .... {/if} {/exp:mx_calc} but still, this is not good solution because whats happens if user will refresh page many times in accepted timeframe? The perfect solution is made small plugin which will do indication that for current entry message was ...


2

add a count to the output maybe? Something like this might help: https://github.com/erikreagan/er.entry_category_count.ee_addon This way you could append a class like 'count_1' etc to each category which is output. Actually this might be more suitable as it's EE2.x compatible: http://devot-ee.com/add-ons/bw-category-count


2

You can use stash lists. Store the state separately. On output order by the unique states and use a nested get_list to get the entries/stores per state. (example from Croxton slide: Stash core principles ) {exp:stash:set_list name="my_stores" parse_tags="yes" scope="site"} {exp:store_locator:stores} {stash:item_state}{state}{/stash:item_state} {...


2

There is an add-on from EE Garage that I have used to do that on a store finder before. It's called NSM Channels. http://ee-garage.com/nsm-channels Not sure if there is something similar on Devot-ee.com for free, but I know this works.


2

You just need to vary your syntax slightly: {if '{my_wygwam_field images_only="yes"}'} {my_wygwam_field images_only="yes"} (image code) {/wygwam_field} {/if} This way you're actually telling EE to parse that first tag (inside the conditional statement) - you need to do it this way because it's a tag pair requiring a parameter,so simple ...


2

Have you tried this? The difference is on Line 2. It does mean you're running the conditional against the entire embed string rather than the variable but it may work. {slider} {if "{video}"!=""} {video} {if:else} {if total_rows > "1" && row_count == "1"} <div id='news_slider'> {/if} ...


2

Yikes! With all due respect, this is an extremely inelegant approach. You should never attempt to output different opening tags in this way. Even if you are able to somehow make it work, the next developer to look at this code will be cursing your name! Here are some alternatives: Use the url_titles or the entry_ids directly in segment_3 instead of 1/2/3, ...


2

As someone else has said this is an inelegant approach and there are better ways to do it. But for starters try putting the complete tag pair within each condition and see if that works. i.e. {if segment_3 =="1"} {exp:channel:entries channel ="about" entry_id="33"} stuff {/exp:channel:entries} {if:elseif segment_3=="2"} ...


2

It depends. If you aren't using variables on conditional outside the default order, you can remove ifElse. For example, ifElse parses early variables like member_id and group_id. Take some time to look at the parsing order and see if you need to change it in some way.


2

If I understood what you want, maybe one of these add-ons can help you: Entry Type - A dropdown fieldtype that shows/hides other fields on the publish page; Better Pages - Better Pages is an ExpressionEngine fieldtype designed to make using the Pages module significantly more end-user friendly; Entry Layout - Lets you link custom fields to any entry of your ...


2

If I read your code correctly, you use Matrix field to keep images. Try next code for this: <div class="left article_image"> {if article_images:total_rows>0} <ul data-orbit> {article_images} <li> <img src="{image_matrix_image}" alt=""> <div class="caption"> ...


2

There are some issues in EE 2.9 with conditionals on prefixed variables and variable modifiers which I don't totally grok. (See bug report here for some discussion.) But the moral is, try this: {if '{promotions:tour_show_specials_banner}' == 'y'}


2

You cannot close your exp:channel:entries-tag in a branch of the if-structure, because in case you have a banner (first branch) you finish the channel-loop and will not get to the end of the if-construct. Vice versa if you do not have a banner you will not end the channel-loop. Therefore put the closing {/exp:channel:entries} after the very end of your code ...


2

try using channel_short_name == "work" You can find the short name in the list of channels. Also in your channel tag, you'll need to specify both channels. channel="work|latest"


1

Why not to put the code of {embed="_includes/tabs"} into a snippet? In my sample code, I'm calling it snip_tabs. {exp:brilliant_retail:product} <div class="inner_container"> <div class="product_detail"> {if "{store_id}" == "2641" OR "{store_id}" == "2635" OR "{store_id}" == "2572" OR "{store_id}" == "2619" OR ...


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

If you use some custom text field to keep timestamp, in this case I think you need activate php and set it to be parsed on "input": <?php $beginOfDay = strtotime("midnight", ee()->localize->now); $endOfDay = strtotime("tomorrow", $beginOfDay) - 1; ?> {exp:channel:entries channel="LIVE_STREAM" search:timestamp_field="<&...


1

You are comparing two variables where you compare one with quotes "" and one without. So that probably gives a mismatch because it compares the two variables as different types. So change this: {if segment_4=="{url_title}"} class="current"{/if} into: {if "{segment_4}"=="{url_title}"} class="current"{/if} probably also this would work (not tested). {if ...


1

You're going to run in to parse order issues here I think. Unfortunately the code is not executing in the order you've written it, so certain evaluations won't happen when you're expecting them to. There's a certain point when adding PHP in an EE template that it's best to roll out a custom plugin instead. My general rule when doing something like you're ...


1

Try this: {if '{site_hvite_left}' == '' OR '{site_hvite_right}' == ''} <div class="row-small"> {if:else} <div class="row"> {/if} .. a bit verbose but it should work every time.


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