Not sure why others aren’t having this issue because it seems extremely common…
I’m trying to pull in channel entries using a morsel. I want to pass a variable for category, using the dynamic data approach.
Here is a sample URL. I use “c” as my category indicator:
http://www.site.com/group/template/c/category-url-title
In that template I have a fetch setup like this:
{exp:template_morsels:fetch name="get-channel-entries" blog_category="{segment_4}"}
And then the morsel looks something like this:
{exp:channel:entries channel="blogs" category="{blog_category}"}
<p>{title}</p>
{/exp:channel:entries}
That all seems great. However, the EE Channel Entries tag requires a Category ID to be specified, not Category URL Title.
I tried various methods such as this to pass the Category ID:
{exp:template_morsels:fetch
name="get-channel-entries"
blog_category="
{exp:channel:category_heading disable="category_fields" channel="blogs"}
{category_id}
{/exp:channel:category_heading}
"}
The parsing order doesn’t seem to parse the Category Heading tag before passing through to the morsel.
Not sure what I could do to fix this, without introducing some extra layers of embeds.
Thank you for any suggestions.
-Chris
Hi Chris,
Even with simple templates in EE, having an {exp:...} tag inside the parameter of another {exp:...} tag often just doesn’t work. You can’t place {exp:channel:categories} in the category=”” parameter of {exp:channel:entries}, for example. ![]()
Have you had a look at Low’s seg2cat add-on? This should make it possible to convert your category_url_title in your URL to a category_id, which {exp:channel:entries} can digest, in the templates (and morsels).
Hope this helps
Yes I understand the issues involved with nested EE tags. Thank you very much for the tip on the Addon. This will be very useful for many template functions.
Thank you,
Chris
My pleasure ![]()
I’ll close the thread then, but feel free to post again if you have other questions.