Help - Search - Members - Calendar
Full Version: Category Pages
Movable Type Community Forum > Additional Resources > Tips and Tricks
thomase
Hi!

I would like to create different templates for different categories.  Mostly I want to change the links in the side bar, so that each category index page lists only relevant links.

How would I do this?  One possibility is that there would be a common archive template, but that each category would pull its list of "relevant links" from a different category-specific file.

Any tips on doing this?

thanks,
Elizabeth
ronincyberpunk
I don't think I understand what you're trying to do, if you can be a little more clear I can help you out.

As of now it sounds to me like you just want to use category archiving. But somehow I think you mean something more.

Patrick
kadyellebee
Oh, so you want to have a different list of links for each sidebar of your category archives?  That sounds cool!

There's a couple ways to do this.  One would be to use the Category Description box to make your list.  To get to that, you get into your Categories section of MT, and click on edit category attributes.  The category description box could have links separated by <br> tags, and then on the sidebar of your Category Archive template, you'd add
CODE
<$MTCategoryDescription$>


But you may be already using this box for a real description, so here's another suggestion.
If you have PHP as an option, you could use index templates for each of your categories and then use PHP to include them into the category archive like this:
[code].html'); ?>
When MT published it, it would include a different file in each sidebar.

Post back if you still have more questions smile.gif

Kristine
thomase
Maybe what I want is easily done.  But I'm not clear on it from the documentation.

Here's what I have and what I'd like.  I have a main page, which has links to category archives.  It's a sewing blog, and an example of a category is "belly dancing costumes" or "Chelsea's Wedding Dress".  If you click on the category name on the main page, it opens a category archive page, containing all of the entries in that category.  This is great.

What I would like to have is a sidebar on the category archive pages.  That's fine, I can just edit the category archive template.  But that changes all of the category pages, and I would like to have category-specific content.  Links, for example.  The "belly dancing costumes" links would be different than the "Chelsea's Wedding Dress" links, for example.

How would I do this?  It looks like Mena has done something similar on Sew Wrong.  There are projects, and if you click on one, you get a project page with a project-specific sidebar.

thanks,
elizabeth
nolageek
QUOTE
Maybe what I want is easily done.  But I'm not clear on it from the documentation.

Here's what I have and what I'd like.  I have a main page, which has links to category archives.  It's a sewing blog, and an example of a category is "belly dancing costumes" or "Chelsea's Wedding Dress".  If you click on the category name on the main page, it opens a category archive page, containing all of the entries in that category.  This is great.

What I would like to have is a sidebar on the category archive pages.  That's fine, I can just edit the category archive template.  But that changes all of the category pages, and I would like to have category-specific content.  Links, for example.  The "belly dancing costumes" links would be different than the "Chelsea's Wedding Dress" links, for example.

How would I do this?  It looks like Mena has done something similar on Sew Wrong.  There are projects, and if you click on one, you get a project page with a project-specific sidebar.

thanks,
elizabeth

How about putting your blocks into a module named after the category and then in your templates use <$MTInclude module"=<$MTCategoryName$>"$>

Forgive my incorrect Template Tag names, I'm typing this in a hurry smile.gif

VIncent
kadyellebee
Vincent - the problem with that code is that you can't put one MT tag inside of another like that.

Elizabeth - it looks like maybe we posted at the same time... did you see my above suggestions?

Kristine
nolageek
OH.  Ummm, nevermind?  :)


Vincent
Joni
Well, now, wait a minute.  Don't run off in a frustrated huff (that's for ME to do! ha ha ha!).

Vincent beat me to the punch, but instead of doing what he suggested (which admittedly if it WORKED would have been easier), just make an MT module for each category.  Then customize each category's module to your heart's content.  

This would of course entail you making a separate module AND a separate category template for each category you have.  But I think it will do what you want.  

For example, if I have five categories: recipes, pets, current events, movies and books and blogging - then I'd want a different module for each category.  Such as recipes_module, pets_module, etc.  So there would be an equal number of modules and a corresponding category archive template for each category, with each category's template calling its module from within the template.

I hope this is what you envision....

Joni
thomase
We did post at the same time, Kristine -- I saw yours as soon as I finished mine.  Your suggestion would definitely work, and would provide all of the functionality that I need for right now.  But I think I'll read up on modules and try to figure something out that's more extendable.  Thanks everybody!

elizabeth
thomase
Hmmm.  

It sounds like I'd either have to create a different category template for each category or use the Category description as Kristine described.  I don't see why I should have a module for each category.  It seems instead that I have should have many category templates which contain what is different between each category, and which use a common category module.  The common category module would contain the information that doesn't change for different categories.

It would be great if Vincent's suggestion worked.  Then I could use a single common template, with different modules.

Kristine's suggestion is looking more attractive.

elizabeth
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.