Theme's per page instead of templates

Posted by Community Admin on 03-Aug-2018 14:03

Theme's per page instead of templates

All Replies

Posted by Community Admin on 11-Jul-2017 00:00

Hi All,

We have a requirement where a client would like to have different colours displayed on a page depending on the area that they are in, i.e. the banner should be a certain colour along with the download lists,  news items etc. 

Usually I would create a template and theme per area to get around this however there are potentially 32 colours that they would want to use. Has anyone come across this requirement before?  I thought about having some logic to detect the area they are in and then apply the appropriate css however I would prefer not to hard code anything, also the area names could change. 

Ideally I would like to select a theme per page like you do when you select a theme for a template. 

Any suggestions/idea's would be most welcome.

Thanks

Richard

Posted by Community Admin on 19-Jul-2017 00:00

I coded this into the template directly, just a css class on the body which I can hook into with css to change the colors.  Keeps us on 1 theme... I mean clearly it requires a specific set of rules.

Our rule method just checks the URL (keeps the DB calls to 0)

if startwith /ug 

     ..green

else if startwith /pg

     ..red

else if startwith /pa

     ..purple

else

     ..blue

 

Posted by Community Admin on 19-Jul-2017 00:00

Thanks Steve, I think this is the route we will have to go down. I was worried about people modifying the page/area names and potentially causing issues but it seems the best way forward.

Posted by Community Admin on 19-Jul-2017 00:00

Nothing hardcoded either. I made a new config element in the backend that lets me define new rules on the fly... 

This thread is closed