First and foremost, all help is greatly appreciated! I am trying to figure out a couple of things;
Question #1 - Currently, I am using this syntax to get the list of categories that an entry is associated with and the link to that category page;
{exp:channel:entries channel="THISISMYCHANNEL" cache="yes" orderby="random" sort="desc" limit="3"} {categories}<a href=”{path='category/index'}”>{category_name}{/categories} {/exp:channel:entries}
In my browser when I get the rendered results of the above syntax, I click on the link and get something like this - https://MYWEBSITE/category/category/CATEGORY NAME … Is it right that is duplicating ‘category’ twice?
Question #2 - In association to question 1, I am now trying to create the template (located in path=’category/index’) that is just a dynamic template that no matter what category they click on from the page before, they will come to this page and see the list of entries associated with this category. The issue I am having with this is how am I able to render the current category name and get the correct listing of entries.
As I said, ALL help is greatly appreciated. Thank y’all!
Hi Andy,
There is a bit of a learning curve with ExpressionEngine, but you’ve got the right idea.
First issue- I think you probably want to use the categories tag to output all of your categories as say a navigation list.
But- whether you’re using the categories tag to show all categories or showing the categories for a given entry inside a channel entries tag](https://docs.expressionengine.com/latest/channels/entries.html#categories), it will work the same way.
Take a look at the docs on EE’s URL structure.
So you probably don’t need to make a new template for your categories. You’ve got a template where you output all of your entries, right? Say mysite.com/index.php/blog/entries. So ‘blog’ template group and ‘entries’ template.
It’s got a {exp:channel:entries channel="THISISMYCHANNEL"...
tag on it. It’s going to show all the entries in that channel- limited by whatever other parameters you put on it.
Now if you have a url like: mysite.com/index.php/blog/entries/category/news or mysite.com/index.php/blog/entries/C5 (where 5 is the id of the news category)- that channel entry tag is smart enough to only pull back the entries in category 5. See here for a bit more about category indicators.
You can do this a whole lot of ways, but that’s the basic gist.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.