EllisLab text mark
Advanced Search
     
Categories/Channel issues
Posted: 13 March 2012 11:21 PM
Joined: 2012-02-18
15 posts

Maybe I’m misunderstanding what the purpose of categories are. But this is what I’m trying to accomplish.

I have a channel and 5 categories. My channel entries are split between those categories.
when I click on a category, it goes to the category page where it lists the entries in that category. My issue is: 1. When I click on an entry to go to that entry’s detail page, how do I show both the category title url and the specific entry title url? so http://www.sitename.com/template-name/category-title-url/entry-title-url

2. on the entry detail page, I also have the list of entries below the entry detail so the user doesn’t have to go back to the category page to pick the next entry. I have the dynamic=off parameter, however, it lists all the entries for that channel and not just the ones for that category. Is that possible to just list the entries for a particular category on a entry detail page? Below is a rough sample of how the detail page is. If there was a way to dynamically put the category id in the parameters based on what category that entry is assigned to I could put the category=”” parameter in there, but I’m not sure how to do that without creating a new template for each category and statically calling it out.

{exp:channel:entries channel="channel_name" limit="1" order_by="custom-field" sort="asc"}
{title}
{body}
{custom_field}              
{
/exp:channel:entries}
{exp
:channel:entries channel="channel_name" order_by="custom_field" sort="asc" dynamic="no"}
<li><a href="{title_permalink=" id="{entry_id}">Link to entry</a>
{/exp:channel:entries} 
 
Posted: 14 March 2012 05:49 PM   [ # 1 ]   [ Rating: 0 ]
Joined: 2005-10-18
7343 posts

Hi Center Stage,

What you are after is certainly possible!

For constructing your URLs, you would have this pattern:

http://domain.com/template-group/template/category/category_url_title/url_title 

If you use the index template of your template-group to do all of the work, you can whittle it down to:

http://domain.com/template-group/category/category_url_title/url_title 

Where “category” is your Category URL Indicator as set in Admin->Channel Administration->Global Preferences. You also want to make sure that Use Category URL Titles In Links? is set to “Yes”.

If you don’t want to include the Category URL Indicator in your URLs, you can use Seg2Cat to translate URL segments into category ID information that you can pass dynamically to channel entries tags.

For the second questions try this:

{exp:channel:entries channel="channel_name" limit="1" order_by="custom-field" sort="asc"}
{title}
{body}
{custom_field}              
{
/exp:channel:entries}
{exp
:channel:entries channel="channel_name" order_by="custom_field" sort="asc"}
<li><a href="{title_permalink=">Link to entry</a>
{/exp:channel:entries} 

I look forward to your reply!

Cheers,

 

 
Posted: 14 March 2012 09:43 PM   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-02-18
15 posts

Thanks for your reply. I’m still have issues with the list of the entries below the single entry. If I don’t have the dynamic=“no” parameter then when I click on an entry link, then when that single entry shows only that link shows in the list where I want all of them in that category to show. If I take the dynamic=“no” out, when I click on an entry link then when that entry shows, the whole list shows, but so do all the entries links in that channel and not just the ones from the category that the entry is from. Also I’m having issue getting the category url title to show with the single entries.

so below, is the section of all the entry links that are below the single entry. How would I write the href so that the category would show in the url? How I have it now isn’t working.

{exp:channel:entries channel="channel_name" order_by="custom_field" sort="asc"}
    
<li><a href="{title_permalink=" id="{entry_id}"><span>Lesson {lesson_order}</span><img src="{video_screen_shot}" width="144"/></a></li>
{/exp:channel:entries} 
 
Posted: 16 March 2012 02:45 PM   [ # 3 ]   [ Rating: 0 ]
Joined: 2005-10-18
7343 posts

Hey Center Stage,

Sorry! I left out a rather critical bit.

{title_permalink} does not support parameters like id= I meant to include an example in my reply.

{categories}
<a href="{title_permalink='template-group/category/{category_url_title}'}">
{/categories} 

Give that a run and let me know if you have any questions!

Cheers,

 
Posted: 17 March 2012 12:02 PM   [ # 4 ]   [ Rating: 0 ]
Joined: 2012-02-18
15 posts

cool… thanks! That worked.

 
Posted: 19 March 2012 02:11 PM   [ # 5 ]   [ Rating: 0 ]
Joined: 2005-10-18
7343 posts

Hi Center Stage,

I’m so glad I was able to help!

If you ever need anything else, just start a new thread.

Cheers!