I have multiple channels that I'd like to include, and it would be more convenient to use a wildcard search than piped list. Is there an easy way to do this? Currently I'm thinking of defining a global variable and doing:

{exp:channel:entries channel="{gbl_channels}"}

Where gbl_channels is my piped list since I'll be making this reference in multiple files.

Good way? Any better ways? Thanks for any tips.

4 Answers 4


You are probably best following James answer and use Stash in this case then. You could also probably get something together using the Query Module as well.

I presume you are just using '100' channels as an example, but if you are planning on using a lot of channels in one site, then it might be worth trying to consolidate them if you can. I'm not sure of your EE experience, but having a huge number of channels is probably not a good idea. Not only will it be a pain for you to manage, but also the content administrator will have a hard time working with it.

What kind of data are you planing on working with here? If there is a cross over, I'd suggest merging the channels together as much as possible. There is a great little addon in Devotee called 'Page Type Selector' - (I think) and you can select the type of page you want and only show certain fields. Doing things this way you can manage channels fields in one place and if you every need to modify it, you don't need to go through 100's of fields etc.

If you aren't familiar, take a look at:

Stash: https://github.com/croxton/Stash (this can be a bit of a mind f@*K to start off with, the more you use it, the more powerful you become - A real game changer)

Query Module: http://ellislab.com/expressionengine/user-guide/modules/query/

Page Type Switcher - The one I mentioned above: http://devot-ee.com/add-ons/page-type-switcher

Hope it helps.


Use snippets instead of global variables so that you can use them in the parameter of the channel entries tag, as the snippet will get parsed early. It seems like a good strategy to do this like you said, preparing snippets like "abc1|abc2|abc3" for all the different channel groupings you'll need and then:

{exp:channel:entries channel="{snippet_abc}"}

  • You can use a global variable in the same way. She doesn't need to parse any tags, she just needs to insert a pre-populated list of channels into her channel entries parameter.
    – kmgdev
    Commented May 2, 2013 at 18:33

What are you trying to do with this? Have different templates that have the same code, but are different channel?

Not sure exactly what you need here, but you can specify multiple channels in your channel entries loop by using a pipe | like this:

{exp:channel:entries channel="channel_1|channel_2"}

Is that what ou need? If you have the same code on multiple templates, you could use the URL structure to help you. Create a template group, say, cars.

Our URL will then read http://domain.com/cars when you visit this template group. Then you could use this:

{exp:channel:entries channel="{segment_1"} - with your channel called cars and your template group.

Hope it helps

  • Thanks for the reply. Basically I have a channel entries loop where I want to specify a "channel" parameter. Let's say I have 100 channels who all have "abc" in them. Instead of doing {exp:channel:entries channel="abc1|abc2|abc3|abc4"} and so on, I would like to do {exp:channel:entries channel="abc*"} if possible.
    – jphansen
    Commented May 2, 2013 at 12:34
{exp:stash:set name="channels" parse_tags="yes" type="snippet"}{exp:query sql="SELECT channel_name FROM exp_channels WHERE channel_name LIKE '%whatever%'" backspace="1"}{channel_name}|{/exp:query}{/exp:stash:set}

You can now use channel="{channels}" as a parameter of a channel entries tag.

I've deliberately put it all on one line to avoid potential issues with whitespace but you might find that it also works ok with whitespace using Stash's trim="yes" parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.