Modify Categories?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Modify Categories?

Post by DMotel »

Is it possible to change the way a category reads when you look at it in the page? What I mean is this: I would like my category to be short when you see it in the nugget, but when you choose one of the pages in the category I would like to make it longer and slightly different.
Is this possible? If so..how?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Modify Categories?

Post by garvinhicking »

Hi!

Yes, you can control this all via templating. You can check the variables documented in the s9y.org techincal documentation (Smarty/CSS Variables) and use $category_info for example to fit your index.tpl or entries.tpl.

Plus you can also use the plugin "Extended options for categories" to put a template on each category and then make independent index/entries.tpl templates for each category.

You can then also check on the $view parameter to see if you are reading a startpage, or a category, or an extended entry page. This variable is only available since serendipity 1.1, but previously you could use other variables like $is_single_entry etc.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Post by DMotel »

Thanks!
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Post by DMotel »

Hmm I see an Events plug-in called "Properties/Templates of categories" but not "Extended options for categories". I downloaded that one but don't see any fields in it that look as though I can modify the page.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

That's the one I mean. :)

You can then assign a different template to each category; within the templates .tpl files you can then add your Smarty IF/ELSE checks on the variables I mentioned.

This is not the easiest thing to do, so it might take you some time until you get the hang of it. It's a bit like mixing JavaScript and HTML, because you need those IF/ELSE logical constructs.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Post by DMotel »

You can then assign a different template to each category;
But the site is already using a template (mt3-gettysburg).
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Yes, but you can assign a different template to each category, and thus use independent formattings/layouts using that plugin.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Post by DMotel »

so since I want it to look like the rest of the site should I save the general blog template and give it another name and then modify that?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Yes, I would suggest you to duplicate the current template, and then only make the necessary modifications to the "sub-templates".

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DMotel
Regular
Posts: 67
Joined: Fri Apr 21, 2006 8:49 pm

Post by DMotel »

I'm sorry I am just not getting it. I saved my template with another name but in which file and where exactly would I "hard code" the category name?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

You don't need to hardcode the category name if you use the category-templates plugin to assign a different template for each category. Because then mt-XXX-1/ will be used for your first category, mt-XXX-2 will be used for another category and so forth. You need to assign a specific template to each category to make each category look different.

And you may need to check on the $is_single_entry variable to make a distinction between how to view multiple entries and how to view single entries.

I agree this is not very easy; it involves coding and logic formatting, and the use of Smarty. But that's how it is with customization. :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply