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

Personally, I tend to use separate templates and then do: {embed="_layouts/.two-column"} {snippet_common_page_elements} {!-- Unique page code goes here --}


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

You'd be better off just 'stashing' the image urls and using the CE Image tag from within the layout. Article {f-archive-images} {exp:stash:set_list name="images"} {stash:url}{f-archive-images-image}{/stash:url} {/exp:stash:set_list} {/f-archive-images} Layout First image: {exp:stash:get_list name="images" limit="1"} {exp:ce_img:single src="{...


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

That's Parse Order. Advanced conditionals, like the one in your example, are parsed after PHP is parsed. In fact, it doesn't even matter if PHP is set on Output or Input. So, think of this step by step. First, your PHP is executed, echoing both 1 == 1 is true and 1 == 1 is false. And the var $test is first set to hello, then to goodbye, after which the ...


3

Given that the Stash set is inside a loop, the resulting output would repeat your code above multiple times. Thus you would have multiple instance of {exp:stash:not_empty name='br_bulk'} and {exp:stash:br_bulk} in your template. The first instance of each of these will be parsed by EE, but subsequent instances will be replaced with a marker that will later ...


3

For anyone that has encountered this same issue, Mark Croxton was able to solve the issue at the devot-ee support forum. Essentially, wrapping the next_entry tag pair with a stash parse tag like so {exp:stash:parse}....{/exp:stash:parse} on the first code block solves the issue. Full support thread: http://devot-ee.com/add-ons/support/stash/viewthread/9131


3

If your url contains the proper category you can use Low's seg2cat plugin to grab the id category="{segment_xx_category_id}" http://gotolow.com/addons/low-seg2cat I'm afk from pc, you may have to tweak parse order but I've used this plugin to great affect many times for this purpose.


3

You can do this with exp:stash:parse {exp:stash:parse} {exp:channel:entries entry_id="{stash:recently-viewed}"}{title}{/exp:channel:entries} {/exp:stash:parse} You may need to add process="end" to the exp:stash:parse tag depending on the order of your templates.


3

For others and my future self, here's the regex solution: {exp:stash:get_list name="prod_list" limit="3" match="#^((?!.*(32|244|2|66|etc)).*)$#" against="entryid" orderby="random" scope="site"} … spit out entries {/exp:stash:get_list}


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

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

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.


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