How to restructure an existing C5 website

Permalink
I have around a 130 page website but essentially it is 4 sites in 1. I am now doing a major reorganisation of the existing C5 website and want to streamline stuff where I can.

There are 4 sections (blue, green, teal and purple) and these have link colours and icons that have the appropriate colours applied to by the body id=”blue” for example.

These sections each has a home page which are also type types.

There also details pages, again (blue, green, teal and purple) which each have up to four different layouts 1col, left col, 3 cols and so on.

So I have around 20 page types that serve the 130 page website.

1.How could I reduce the number of page types?
2.How could I create 1 page type, purple for example and then assign a 1, 2 or 3 column layout?
3.Is this what the “add layout” function for? To add page specific layouts or is this more for more minor layouts such as aligning images with text?
4.How could I set body tag to blue to turn my pages to different colours in C5 without creating additional page types?
5.Is it ok to have 20 or so page types?

 
mkly replied on at Permalink Reply
mkly
5. Yes it's fine to have that many page types.
2. Create separate page types for the multiple columns don't use layouts unless you really really have to.
3. No page types are a much better idea than layouts. Trust me, don't use layouts if you have the skill to create new page types.
4. You can use a "Page Attribute" to define a color for a page and then check for this in the header.php of the theme and set the css to change to the appropriate color. I can give you more info if you need on this. I just did this on a project a couple weeks ago.
auscoal replied on at Permalink Reply
Hi thanks for your reply. I got you here, thanks.

If you could shed some more light on how to change a colour based on a header attribute that would great
mkly replied on at Permalink Reply
mkly
I'm go guess you know how to set up a custom page attribute. Create a text attribute called "Header Color" with an handle header_color.

Then inside of your header.php you can do.
<?php
$pg = Page::getCurrentPage();
$color = $pg->getAttribute('header_color');
?>
<?php if(!empty($color)): ?>
  <style>
    body {
      background-color: <?php echo $color ?>;
    }
  </style>
<?php endif; ?>

I would put this below any of the other css files(style.css, main.css etc). If it doesn't apply you may need to change the background-color: line to
background-color: <?php echo $color ?> !important;


Hopefully that makes sense.

~Mike