Custom links/layouts for categories??
Posted: 19 September 2004 03:19 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  01-05-2004

i’m trying to create a navigation based on

{exp:weblog:categories}

<a href=”{path=mysite/company}”>{category_name}</a>

{/exp:weblog:categories}

but my problem is that all the links in that list point to the same template and each category needs to have a differnt layout for the entries. nothing major in terms of layout just that some categories should show the entries with just a title and a summary while other categories need to display title and body.

for example under the weblog called company i have two categories (i have more than that, just keeping it simple) “Who we are” and “Jobs”. the layout for “who we are” needs to just show the {title} and the {body} of the entry where as “jobs” needs to show just the {title} and the {summary}.

there’s only two ways that i think this might be able to get this effect but i’m not finding any details on it.

the first way might be by setting a direct url to each category so i could point it to a special template (just like with a weblog). is that possible??

the other idea would be by using the same template for all the categories but have a bunch of {if} statements to hide or show elements based on the current selected category (just like with {group_id}). is that possible??

how would i go about doing either one of them, or is there a better way to do this all together??

thanks
scott

Profile
 
 
Posted: 19 September 2004 03:22 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

My own preferences, where you would require different layouts, would be to use totally different weblogs.

But otherwise, you could make speciality templates and just use exp:weblog:entries with hte propery category and then proper layout - then hardlink to that template.

I’m not sure you could use this with that container tag though. :(

 Signature 
Profile
MSG
 
 
Posted: 19 September 2004 03:49 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  01-05-2004

ya i already have quite a few weblogs for all the other sections. and each section has their own sub-sections (categories in this case). i would prefer to use just one template to list the entries of the section’s categories. so is there anyway to do an {if} statement based on category? maybe even using php?

thanks

Profile
 
 
Posted: 19 September 2004 03:53 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

there are examples here of using php to do that, but I don’t have a specific link.  It has be be php because each entry can have multiple categories so the ee conditionals don’t handle it.

A search for php category or similar should bring up some ideas. =)

 Signature 
Profile
MSG
 
 
Posted: 19 September 2004 03:55 PM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  01-05-2004

thanks! i’ll check it out

Profile
 
 
Posted: 19 September 2004 04:10 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  01-05-2004

i guess i just need to handcode the category list so i can define the unique link and any classes for css styling.
thanks

Profile
 
 
Posted: 22 September 2004 12:11 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  520
Joined  05-14-2004

Unless I’m totally misunderstanding what you’re trying to do then I think you could pull off what you want using {if} conditionals depending on what you need to have change from category to category. It sounds like you just want to change what parts of each listing is displayed depending on the category rather than the whole template being a completely different style and if so then it should be doable.

Of course, depending on how many categories you’ve got that could add up to a lot of IF statements.

 Signature 

“I was gratified to be able to answer promptly, and I did. I said I didn’t know.” - Mark Twain, Life on the Mississippi

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64938 Total Logged-in Users: 59
Total Topics: 81908 Total Anonymous Users: 47
Total Replies: 440306 Total Guests: 289
Total Posts: 522214    
Members ( View Memberlist )