Hi All,
I’m looking for a solution to output the below, but cant seem to get the switch value to close the DIV using what we have below.
https://ryde.digital/ee_ryde.txt
We cant get the count to close the divs using the switch method as the counts are inconsistent :/
Any help would be gratefully received.
The Channel Entries tag is not meant to be nested, as it is easy to make a small mistake and have excessive, site-killing looping. What you are seeing is the category tag parsing all of the count variables—it has no way of knowing your intention is that another tag will parse a {count}
later. Will the category archives tag not do what you need?
Correct, that tag was conceived to help dissuade attempts at what I’m about to tell you to do, because depending on your content, this could get out of hand quickly. So to keep the performance zippy, the category archives tag leaves out custom fields. You’re needing to isolate the Channel Entries tag from the Categories tag, which is what embeds were designed to do. If you have hundreds of categories, let me know, because this would not be a performant solution in that instance:
Main template:
{exp:channel:categories category_group='4' style='linear' show_empty='no'}
...
{embed='template_group/_cat_entries' category_id='{category_id}'}
...
{/exp:channel:categories}
template_group/_cat_entries
:
{exp:channel:entries channel="team" category="{embed:category_id}" dynamic="no"}
...
{/exp:channel:entries}
Hi Derek,
I tried this but unfortunately it just repeated each channel entry four times - thanks for trying though.
Ive had to result to this rather lengthy method for now to get us out of trouble but may come back to this when I get a mo.
https://ryde.digital/ee_ryde.txt
Thanks Scott
Did you mean to post a different set of template code? That looks like the same in your OP.
The sample I gave will output a Channel Entries tag for each category ID. You can check the Template tab of the debugger to see what resulting Channel Entries tags are being called. Are these entries in multiple categories within this category group by chance? That would cause them to be output once for each category they are in.
Hi Derek, try and refresh that file and it should load in - this is exactly what we are trying to achieve, albeit neatly and DRY but always seem to struggle with this kind of structure - maybe we are approaching it wrong but would be good to find a solid solution we can use as we tend to get a lot of sites structured this way.
Does the example highlight what we are trying to achieve?
That’s what the sample I shared above should ultimately output. Can you make sure you are trying this on a reduction template with no other tags than what I indicated above, and if that’s not working, share your full templates and the output from the Template tab of the Debugger?
Aside, you may want to replace the legacy {switch=}
variables with modulus conditionals on count.
Hi Derek, I have tried this again but it’s still outputting incorrect - I can give you access to the template if that helps - drop me an email ([email protected]) and I’ll send you the CP access if thats OK?
Hi Ryde,
Thanks for that, I had seen the text file higher up in the thread. However, what I was looking for is the raw HTML you are trying to achieve. The way the multiple switches (especially the ‘|||’) are implemented are sort of throwing me. I was hoping see the compiled HTML might help clarify things.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.