Hot answers tagged

13

Stash and Low Variables are complementary. Low Variables Essentially a replacement for native snippets and global variables. Provides a control panel interface for managing variables. Variables may be considered content - text values, matrix data, default images - or code, such as a tag that outputs your primary navigation or contains your footer markup. ...


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


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


5

Files are written to the static cache directory by Stash - you don't put files in there. Typically these cached files would be your fully rendered HTML pages. This is the opposite of the stash template directory, where you add template files (containing EE tags, variables etc.) which are read by Stash. After creating a folder called 'static_cache' (or ...


5

The reason you do not have access to that variable outside the loop is because your stash tags (getters and setters) are not parsed at the same time. EE module tags are parsed recursively from the outwards inwards, peeling them one after another like a oignon. In your code above, your stash set tags are inside an entry loop (level 2), while your get tag 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

Are you using the latest version of Stash (as of writing 2.3.9)? Your code should work but a few versions back there was a bug in {exp:stash:parse} which meant that parse_vars didn't get run under certain circumstances. https://github.com/croxton/Stash EDIT: just realised you've left off the wrapping channel entries tag which would have made it clear why ...


3

The first thing I would ask is do you really need a fieldgroup for each product channel? Multiple channels can share the same fieldgroup and you can use publish layouts to hide the fields that are not relevant to a particular product. Using the same fieldgroup will also force you to generalise the fields you use which can be a good thing for rationalising ...


3

Your original code can't work because of parse order. Tag pairs are not parsed procedurally as you assume. Module tags are parsed from the outer layer inwards - like peeling an onion. Plugin tags (the low_replace tag in this instance) are parsed in the opposite direction (unless parse="inward"). In your code therefore the get_list (layer 2) occurs before ...


3

You can use the sort_type="integer" parameter when you use get_list. That might help you out. Here's the wiki for the get_list.


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

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

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


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