Assign specific them to static pages/categories

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
user1234
Regular
Posts: 75
Joined: Tue Sep 22, 2009 9:49 pm

Assign specific them to static pages/categories

Post by user1234 »

Hi,

possibly I just have tomatoes for eyes, but I can't find it. Is there a way that I can assign different themes to certain (static) pages and to categories? I don't mean templates, I really mean themes.

Cheers

Dachs
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Assign specific them to static pages/categories

Post by Don Chambers »

Need to be careful with vocabulary. For the most part, theme, template, and styles are used interchangeably. The exception is when discussing smarty template files (*.tpl).

There is a plugin called properties/templates of categories which allows different categories to use different themes. Static pages, however, have no way to be associated with a specific category, although such a feature has been on the wish list for a long time. Unfortunately, nobody with that skillset has found the time to implement the feature.
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Assign specific them to static pages/categories

Post by garvinhicking »

Hi DOn!

Actually, categories can be associated with staticpages! There's even a readme file in it.

Changing the look for a staticpage side wouldn't also be too hard. You can already use custom template files for each staticpage, which usually only controlls the "inner" look of a page.

BUT you can change your index.tpl file so by checking {if $staticpage_pagetitle != ''}...{/if} to only make your blog output the framework/body part of a page if NO staticpage is chosen. This way, you can put ALL of the HTML framework inside a single static page (by thus defeating the reason of static pages though, because you could better write up a static .html page now ;) )

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/
user1234
Regular
Posts: 75
Joined: Tue Sep 22, 2009 9:49 pm

Re: Assign specific them to static pages/categories

Post by user1234 »

Hi,

okay - to explain this:

1. Static pages show sidebar - sidebar changes depending on which staticpage is called (when static page A is chosen, sidebar A is shown and stays relevant through all childpages under A, staticpage B is chosen, sidebar B is shown and stays relevant through all childpages under B, etc etc)

2. News/Blog section - no sidebar and uses full width of theme

Any ideas how this could be done?

Cheers

Dachs
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Assign specific them to static pages/categories

Post by garvinhicking »

Hi!

To do this, you can setup multiple sidebars A, B, C etc. (using a templates config.inc.php, like some themese do -- $serendipity['sidebars']). Then inside index.tpl where serendipity_printSidebar is used, do a check for which staticpage is called ({if $staticpage_pagetitle == 'XXX'}...sidebar A...{elseif...}). Alternatively, you could even use custom staticpage fields to set a special variable to A, B, C etc. and abstract that furthermore, and not put a name check in index.tpl. This is definitely possible, but such customization comes at a price of writing the conditional clauses into your template(s).

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/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Assign specific them to static pages/categories

Post by Don Chambers »

garvinhicking wrote: Alternatively, you could even use custom staticpage fields to set a special variable to A, B, C etc. and abstract that furthermore, and not put a name check in index.tpl.
This is how I would probably approach it too with the new static page functionality.

If the content does not have to be a true static page item, but something that could just be maintained in index.tpl, I would do the logic there, do the logic test for certain static pages, emit what I needed, then call the usual sidebars..
=Don=
Post Reply