Extension, Module

Archived
Forum
(read-only)

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

     

stash variables in channel parameter

Support Request

rob_H
rob_H

Goal: DRY. Therefore I use some stash variables and want to use them as channel entries parameters like this:

{exp:stash:set name="stat"}
 {if logged_in}open
|private{if:else}open{/if} 
{
/exp:stash:set}

{exp
:channel:entries channel="schedule"
 
status={exp:stash:get name='stat'}
 orderby
="date" sort="asc"
 
limit="12" paginate="bottom"
 
show_future_entries="yes"
 
dynamic="no"
}
...
{/exp:channel:entries} 

The actual query as shown in debugging mode is always using

t.status 'open' 

As a matter of fact, even when I use

{exp:stash:set name="stat"}open|private{/exp:stash:set} 

it still shows only open entries. Wrapping the whole channel entries tag inside

{exp:stash:parse} 

also doesn’t give the desired result. The only workaround I can think of is checking if you’re logged in and use 2 times the channel tag but that’s exactly what I try to avoid here.