4

I've got a page that I've created using the Pages module, and inside the template for that page I'm trying to display a list of entries from 4 different channels on my site. But the {exp:channel:entries} tag returns nothing. Using the Template Debugging I can see that this tag is attempting to retrieve a list of entries, but then it says that 0 entries were returned?

What am I doing wrong?

Answer

The key is to use dynamic=no in the {exp:channel:entries} tag. So instead of:

{exp:channel:entries channel="channel1|channel2"}

Use

{exp:channel:entries dynamic="no" channel="channel1|channel2"}

Of course, if you're already using the

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

tag to access the page title, etc..., you can't embed another channel entries tag inside that tag, so you'll have to put your code into an embedded template.

So the end result would be something like:

{exp:channel:entries channel="pages"}
  <h1>{title}</h1>
 <!-- other page code stuff -->

   <!-- now embed your template that uses the channel entries with dynamic=no -->
   {embed="<yourtemplategroup>/<yourembeddedtemplate"}

{/exp:channel:entries}

1 Answer 1

6

Try adding dynamic="no" to your channel:entries tag, otherwise it will try to fetch entries based on the URL.

3
  • This is the correct answer.
    – CreateSean
    Nov 6, 2013 at 16:48
  • Thanks, I actually solve this, and Anna Brown asked me to document it here, so I posted the question then tried to answer it myself but couldn't. Nov 6, 2013 at 16:52
  • 1
    you can still mark this as the accepted answer Nov 8, 2013 at 14:26

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.