Hot answers tagged

7

The problem with that is that if {parent_id} doesn't get replaced with a number before the conditional is evaluated, then EE will choke because when converted to PHP it becomes: if ({parent_id} == 0) Either this {if parent_id != 0} Or this {if "{parent_id}" != "0"} Is more fault tolerant when the variable doesn't exist. But, you may wonder, why is ...


5

You have an extraneous single quote ' in each of your opening tag pairs. {stash:ee_img_original_width'}{width_orig}{/stash:ee_img_original_width} Should be: {stash:ee_img_original_width}{width_orig}{/stash:ee_img_original_width}


5

UPDATE: Got it working. This is what I have for those following: set_list template: {stash:embed:layouts:homepage} {exp:stash:context name="100_list"} {exp:stash:set_list name="movie_list" context="@" parse_tags="yes" save="yes" scope="site" refresh="1440" replace="no" } {exp:channel:entries channel="films" ...


5

{exp:stash:get name="foo"} is a module tag. When the template parser encounters it, it calls the get() method of the 'stash' module class, which returns the value of foo. If foo doesn't exist, an empty value is returned, unless the default="" parameter has been set. {exp:stash:foo} is a shorter syntax version of the above tag, for convenience. {stash:foo} ...


5

There's no sense in running channel entries twice. This code generates a bunch of stash capture pairs, mapping field names in different channels to a common name: {!-- make a list of your channel prefixes --} {exp:stash:set_list name="channels"} {stash:channel}article{/stash:channel} {stash:channel}book{/stash:channel} {stash:channel}project{/...


5

You can do this without a callback function: $config['resource_router'] = array( 'posts' => 'templates/index', 'posts/:category_url_title' => 'templates/cat_entries', 'posts/:category_url_title/:any' => 'templates/view', );


4

{exp:stash:static} caches the entire page to a static file. The cached output is not stored in the database. And you can't cache just a region / section of the page. When it works for you to use {exp:stash:static}, it should return pages noticeably faster than {exp:stash:cache}, and also (since the page requests route directly to the static file, without ...


4

Couldn't you just use a Snippet for this? It would contain the markup and code used inside a tag, which you could re-use with multiple tags. For example: {exp:low_search:results ... } {sn_entry_list} {/exp:low_search:results} {exp:channel:entries ... } {sn_entry_list} {/exp:channel:entries} An so on.


4

If your {exp:stash:get_list} tag is wrapped by another tag pair, then commonly used template variables like no_results are parsed for the parent tag by EE. Add the prefix="my_prefix" parameter to provide a namespace, and use the prefix like this: {if my_prefix:no_results}...{/if} There are a few other ways to check that a list exists (or is empty): With ...


4

This solution doesn't use Stash, but you certainly could. This query assumes a broad application, you may be able to simplify it for your needs. The channel_id in the WHERE clauses will need to be modified to match your channel ID, or converted to a WHERE IN () if you are examining more than one channel (or omitted if no channel filtering is needed). {exp:...


4

You use plugin with the same parameters. So EE cached it. Try to add random {exp:stash:set name="sorthead" random} {/exp:stash:set} or change name.


4

Using the matches operator, which was added in EE v2.9.0: {if segment_2 ~ "/^\d+$/"} [...] {/if}


3

Another wild idea if you can't figure it out with parse order. Use Javascript! if ($(".product-list-item").size() == 0) { $(".product-no-items").show(); } Not the most elegant solution, but if you're up against a deadline then it will certainly work.


3

Try capturing the entry_ids to set a stash value then use that value to define the calendars tag. Grab the entry_ids for the events. {exp:stash:set parse_tags="yes"} {exp:channel:entries channel="education" disable="categories|member_data|pagination"} {stash:event_ids}0{exp:playa:children channel="calendar_events" limit="5"}|{entry_id}{/exp:playa:...


3

I don't tend to use Stash to duplicate the data model. In this case you would be adding a close coupling between the generation of the list and the individual offer pages. That adds fragility. As far as possible you should separate the functionality and presentation of your site into components that are not dependent on one other. You can and should still ...


3

Snippets Snippets are loaded in just one database query - but this query returns every single snippet on the website - even if the page doesn't need it. This behaviour makes what is otherwise a really efficient way of reusing elements really quite inefficient. You should only use Snippets for elements that are used throughout the site. The things that are on ...


3

Turns out the problem wasn't a parse issue after all. Playa disables categories by default so by placing a blank disable="" parameter on the {cf_feed_videos} tag it overrides this and re-enables categories for the related entries.


3

For the {exp:stash:get} tag save is only used with dynamic="yes" when retrieving dynamic values from $_POST, $_GET or segment arrays. For your menu it only makes sense to stash the parts of your menu as separate lists if you are re-using those values elsewhere. Otherwise, just wrap the tags that generate the menu with a {exp:stash:set} with the output ...


3

If you use that code in an EE template (rather than a Stash embed) then EE will parse {segment_1} early, before tags are run and before Stash can escape it. See step 1 here: http://loweblog.com/downloads/ee-parse-order.pdf The good news is you can access any global variable or snippet as a tag like this: {exp:stash:get name="segment_1" type="snippet"} ...


3

Stash 2.4.3 corrected a long-standing inconsistency with embeds set to process at the start of template parsing. At the other stages of parsing (inline and end) embeds are parsed by default - that is to say, parse="yes" is the default parameter value if not specified, and 2.4.3 added this as the default for start too. To make your embed behave as it did ...


3

Reposting here the solution that I posted on Devot:ee to the same question: <ul> {exp:stash:get_list name="location_list"} {if 0 == {exp:stash:list_count name="checked_locations" match="#^{entry_id}$#" against="entry_id"}} <li>{entry_id}</li> {/if} {/exp:stash:get_list} </ul>


3

You can capture the entries as a Stash list and use fractions to split into parts: Setting the list: https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aset_list%7D#capturing-channel-entry-data Getting the list and using fractions: https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aget_list%7D#using-fractions-to-split-lists


3

You're essentially using the embed as a snippet, so you could do this: {!-- viewmodels/categories.html - include the code but don't parse --} {stash:embed:viewmodels:categories process="start" parse="no"} <category_sport_name_ms> {exp:stash:get_list name="export_categories" match="#^sport$#" against="type"} <str><![CDATA[{name}]]></str&...


3

In your channel entries tag, use the fixed_order parameter instead of entry_id.


3

Good news, it should be a quick fix. All you need is to prefix your Playa variables with var_prefix parameter to differentiate the namespace from the Channel Entry variables, although you might have to use the full module tag: {exp:playa:children field="item_colors" var_prefix="pl"} "{pl:title}": "{title}", {/exp:playa:children}


3

This is a tag parse order problem, and it arises because you are (if I understand you correctly) setting your 'page_title' variable in the view template (the embed) - and trying to access it in the same template. Something like this: {exp:switchee variable="{segment_1}" parse="inward"} {case value=""} {sn-home-data} {/case} {case default="yes"} ...


3

I finally got this working (Low Search working with Stash static cached homepage)!!! I added the following rule to my .htaccess, to get it to really really ignore POST requests. I'm not sure why this works (maybe it's my server environment? I'm on a Nexcess EE-Optimized plan). So I added the following RewriteCond RewriteCond %{THE_REQUEST} ^(GET) And ...


3

You embed IS being "cached" - saved to the Stash database table as a variable - but it's not being parsed before being cached. That is because, out of the box, a Stash embed works just like an EE embed: the content of the embed file is included into the host template and then parsed at runtime. The parsing stage of an embed is controlled by the ...


3

The quotes around {fn_zone} mean it's an advanced conditional which may be the problem. Can you do: {if fn_zone == ""} ... {/if} Or you may have to use the if:else plugin: {exp:ifelse parse="inward"} {if "{fn_zone}"!=""} {redirect="/store"} {if:else} {exp:stash:destroy name="delivery_day"} {/if} {/exp:ifelse}


3

I think that by caching both lists, you could reduce queries a little bit further. Easier to add Stash caching / Mustash to the mix too. Something along the lines of: {!-- set stockists list (consider caching with bundles and mustash forever) --} {exp:stash:set_list name="stockists" parse_tags="yes" parse_conditionals="yes" save="yes" ...


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