Extension, Module

Developer
Supported

Stash

ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6

Back to this add-on's main page
View Other Add-ons From Mark Croxton

     

You must be logged in to post.

How about a stash type of “both”

General

IOS Admin
IOS Admin

Because of how and where I need to use stash variables I find myself creating a variable and snippet version of the same data.

It would be nice to set the type to “both” and end up with data I can use as a variable and snippet.

I am new to stash so I may be missing something.

I store and ID for a group based on a URL segment. I then want to reuse this thru-out my templates.

Using the stash tag works well with vars, but I have to use a snippet if I want to use the data as the parameter in a tag.

Here is an example:

{exp:stash:set name="my_group_id" scope="user"}{friends_group_id}{/exp:stash:set}
  {exp
:stash:set name="my_group_id_" scope="user"}{friends_group_id}{/exp:stash:set}

  Group ID
{exp:stash:get name="my_group_id"}
  {exp
:friends:groups group_id="{my_group_id_}"}
    Group Name
{friends_group_name}
  {
/exp:friends:groups} 
Mark Croxton
# 1
Developer
Mark Croxton

You just need to add parse=“inward” to your tag to get it to parse a tag passed as a parameter. No need to save the variable twice.

{exp:friends:groups group_id="{exp:stash get name='my_group_id'}" parse="inward"}
    Group Name
{friends_group_name}
{
/exp:friends:groups}