WebsiteBaker Support (2.8.x) > Templates, Menus & Design

Change color template different css

<< < (2/4) > >>

Ruud:
For just one level it is not that hard.
WB has a variable PARENT too. This one has the PAGE_ID of the parent of the current page.


--- Code: ---<?php 
$css = "red.css"; //default
if (PAGE_ID==1} $css = "blue.css";
if (PARENT==1} $css = "blue.css";

if (PAGE_ID==2} $css = "yellow.css";
if (PARENT==2} $css = "yellow.css";

if (PAGE_ID==382} $css = "brown.css";
if (PARENT==382} $css = "brown.css";

echo TEMPLATE_DIR.$css;
?>
--- End code ---

Vincent:
Super, thanks.

sky writer:
I suddenly require this "shortcut" functionality, as I have a client who wants me to show them their website with all sorts of different colour schemes on different hidden pages.

I was trying to implement Ruud's first suggested work-flow, but I don't know where I am supposed to put the code.  I assumed it would go in the template index.php file, but then I don't know what to do with the present code:

--- Code: ---<?php 
// automatically include optional WB module files (frontend.css, frontend.js)
if (function_exists('register_frontend_modfiles')) {
register_frontend_modfiles('css');
register_frontend_modfiles('js');
} ?>

<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATE_DIR; ?>/style.css" media="screen,projection" />
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATE_DIR; ?>/print.css" media="print" />
--- End code ---

And direction would be greatly appreciated.

Ruud:
Correct, this should be generated somewhere in the <head> section of the template.

If you use the color stylesheets just to override the default layout/colors put it after your normal style.css lines.
The rest of your current template should not be changed.

sky writer:
Thanks for your reply, but I'm doing something wrong.

When I add your code to my head section:

--- Code: ---<head>
<?php simplepagehead('/', 1, 1, 1, 0); ?>
<meta http-equiv="Content-Type" content="text/html; charset=<?php if(defined('DEFAULT_CHARSET')) { echo DEFAULT_CHARSET; } else { echo 'utf-8'; }?>" />

<?php 
// automatically include optional WB module files (frontend.css, frontend.js)
if (function_exists('register_frontend_modfiles')) {
register_frontend_modfiles('css');
register_frontend_modfiles('js');
} ?>

<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATE_DIR; ?>/style.css" media="screen,projection" />
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATE_DIR; ?>/print.css" media="print" />
<link rel="Shortcut Icon" type="image/x-icon" href="<?php echo WB_URL; ?>/favicon.ico" />

<?php 
$css = "style.css"; //default
if (PAGE_ID==21} $css = "dark.css";
echo TEMPLATE_DIR.$css;
?>

</head>
--- End code ---

Every pages loads as blank.  Any thoughts?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version