PHP Classes

File: themeContent.php

Recommend this page to a friend!
  Classes of Gerry Danen   Theme Roller   themeContent.php   Download  
File: themeContent.php
Role: Application script
Content type: text/plain
Description: CSS rules
Class: Theme Roller
Generate CSS stylesheets with color palette themes
Author: By
Last change: Updated
Date: 8 years ago
Size: 2,979 bytes
 

Contents

Class file image Download
<?php
@session_start();

require_once
'themeRoller.class.php'; // make the class available

//$theme = ThemeRoller::selectTheme(); // get a theme code, use generic default
$theme = ThemeRoller::selectTheme(TRUE); // get a theme code, use seasonal default

$roller = new ThemeRoller($theme, 'Colour theme: {{theme-title}}'); // instantiate with theme code and title

$roller->addSelector('body, html', 'entire page');
$roller->addRule('margin', '0');
$roller->addRule('font-size', '1.1em');
$roller->addRule('font-family', '"Courier New", Courier, monospace');

$roller->addSelector('.panel-body', 'modifies panel-body attributes - this is where the theme shows, could be body/html');
$roller->addRule('color', $roller->getThemeDefValue('color'));
$roller->addRule('background-color', $roller->getThemeDefValue('background-color'));
$roller->addRule('font-family', "'lucida grande', helvetica, verdana, arial, sans-serif");
$roller->addRule('padding', '4px 10px');

$roller->addSelector('.reverse-panel-body', 'reverses fg & bg');
$roller->addRule('color', $roller->getThemeDefValue('background-color'));
$roller->addRule('background-color', $roller->getThemeDefValue('color'));

$roller->addSelector('#introText');
$roller->addRule('font-size', '1.4em');
$roller->addRule('font-style', 'italic');
$roller->addRule('margin-top', '10px');

$roller->addSelector('.rollerSpecial');
$roller->addRule('border', 'thin solid ' . $roller->getThemeDefValue('border-color'));
$roller->addRule('padding', '4px 8px');
$roller->addRule('margin', '0 6px');

$roller->addSelector('.taLeft');
$roller->addRule('text-align', 'left');

$roller->addSelector('.taCenter');
$roller->addRule('text-align', 'center');

$roller->addSelector('.taRight');
$roller->addRule('text-align', 'right');

$roller->addSelector('.bold');
$roller->addRule('font-weight', 'bold');

$roller->addSelector('.italic');
$roller->addRule('font-style', 'italic');

$roller->addSelector('.under, .underline, .underlined');
$roller->addRule('text-decoration', 'underline');

$roller->addSelector('.flexImage', 'responsive image, left justified');
$roller->addRule('display', 'flex');
$roller->addRule('flex-shrink', '1');
$roller->addRule('max-width', '100%');
$roller->addRule('min-width', '200px');

$roller->addSelector('.flexImageCenter', 'responsive image, centered');
$roller->addRule('display', 'flex');
$roller->addRule('flex-shrink', '1');
$roller->addRule('max-width', '100%');
$roller->addRule('min-width', '200px');
$roller->addRule('align-items', 'center');
$roller->addRule('margin', 'auto');

$roller->debug(); // to allow the css file to be written
$rollerCSS = $roller->generateCSS();

//$roller->dumpAll(); // shows internal data after generating the CSS, useful for seeing how things work

// these files are normally not needed, just for use in the sample.php script
$paletteListSelectedTheme = $roller->getThemePalette();
$paletteList = $roller->getAllPalettes();
$cssFile = $roller->getCssFile();