HTML_CSS
[ class tree: HTML_CSS ] [ index: HTML_CSS ] [ all elements ]

File: CSS.php

Source Location: /HTML_CSS-0.3.4/CSS.php

Classes:

HTML_CSS
Base class for CSS definitions

Page Details:

Base class for CSS definitions

This class handles the details for creating properly constructed CSS declarations.

Example for direct output of stylesheet:

  1.  require_once 'HTML/CSS.php';
  2.  
  3.  $css = new HTML_CSS();
  4.  
  5.  // define styles
  6.  $css->setStyle('body''background-color''#0c0c0c');
  7.  $css->setStyle('body''color''#ffffff');
  8.  $css->setStyle('h1''text-align''center');
  9.  $css->setStyle('h1''font''16pt helvetica, arial, sans-serif');
  10.  $css->setStyle('p''font''12pt helvetica, arial, sans-serif');
  11.  
  12.  // output the stylesheet directly to browser
  13.  $css->display();

Example of group usage:

  1.  require_once 'HTML/CSS.php';
  2.  
  3.  $css = new HTML_CSS();
  4.  
  5.  // create new group
  6.  $group1 $css->createGroup('body, html');
  7.  $group2 $css->createGroup('p, div');
  8.  
  9.  // define styles
  10.  $css->setGroupStyle($group1'background-color''#0c0c0c');
  11.  $css->setGroupStyle($group1'color''#ffffff');
  12.  $css->setGroupStyle($group2'text-align''left');
  13.  $css->setGroupStyle($group2'background-color''#ffffff');
  14.  $css->setGroupStyle($group2'color''#0c0c0c');
  15.  $css->setStyle('h1''text-align''center');
  16.  $css->setStyle('h1''font''16pt helvetica, arial, sans-serif');
  17.  $css->setStyle('p''font''12pt helvetica, arial, sans-serif');
  18.  
  19.  // output the stylesheet directly to browser
  20.  $css->display();

Example in combination with HTML_Page:

  1.  require_once 'HTML/Page.php';
  2.  require_once 'HTML/CSS.php';
  3.  
  4.  $css = new HTML_CSS();
  5.  $css->setStyle('body''background-color''#0c0c0c');
  6.  $css->setStyle('body''color''#ffffff');
  7.  $css->setStyle('h1''text-align''center');
  8.  $css->setStyle('h1''font''16pt helvetica, arial, sans-serif');
  9.  $css->setStyle('p''font''12pt helvetica, arial, sans-serif');
  10.  
  11.  $p = new HTML_Page();
  12.  
  13.  $p->setTitle("My page");
  14.  // it can be added as an object
  15.  $p->addStyleDeclaration($css'text/css');
  16.  $p->setMetaData("author""My Name");
  17.  $p->addBodyContent("<h1>headline</h1>");
  18.  $p->addBodyContent("<p>some text</p>");
  19.  $p->addBodyContent("<p>some more text</p>");
  20.  $p->addBodyContent("<p>yet even more text</p>");
  21.  $p->display();

Example for generating inline code:

  1.  require_once 'HTML/CSS.php';
  2.  
  3.  $css = new HTML_CSS();
  4.  
  5.  $css->setStyle('body''background-color''#0c0c0c');
  6.  $css->setStyle('body''color''#ffffff');
  7.  $css->setStyle('h1''text-align''center');
  8.  $css->setStyle('h1''font''16pt helvetica, arial, sans-serif');
  9.  $css->setStyle('p''font''12pt helvetica, arial, sans-serif');
  10.  $css->setSameStyle('body''p');
  11.  
  12.  echo '<body style="' $css->toInline('body''">';
  13.  // will output:
  14.  // <body style="font:12pt helvetica, arial, sans-serif;background-color:#0c0c0c;color:#ffffff;">

Includes:

require_once('Log.php') [line 127]
Error logging file

The reason these are required here is because they are needed in _initErrorStack, which is called in the constructor.

  • Since: 0.3.3
require_once('PEAR/ErrorStack.php') [line 128]
Error logging file

The reason these are required here is because they are needed in _initErrorStack, which is called in the constructor.

  • Since: 0.3.3
require_once('HTML/Common.php') [line 117]

HTML_CSS_ERROR_INVALID_GROUP [line 138]

HTML_CSS_ERROR_INVALID_GROUP = -101
Basic error codes
  • Since: 0.3.3

[ Top ]



HTML_CSS_ERROR_INVALID_INPUT [line 137]

HTML_CSS_ERROR_INVALID_INPUT = -100
Basic error codes
  • Since: 0.3.3

[ Top ]



HTML_CSS_ERROR_NO_ELEMENT [line 140]

HTML_CSS_ERROR_NO_ELEMENT = -103
Basic error codes
  • Since: 0.3.3

[ Top ]



HTML_CSS_ERROR_NO_ELEMENT_PROPERTY [line 141]

HTML_CSS_ERROR_NO_ELEMENT_PROPERTY = -104
Basic error codes
  • Since: 0.3.3

[ Top ]



HTML_CSS_ERROR_NO_FILE [line 142]

HTML_CSS_ERROR_NO_FILE = -105
Basic error codes
  • Since: 0.3.3

[ Top ]



HTML_CSS_ERROR_NO_GROUP [line 139]

HTML_CSS_ERROR_NO_GROUP = -102
Basic error codes
  • Since: 0.3.3

[ Top ]



HTML_CSS_ERROR_WRITE_FILE [line 143]

HTML_CSS_ERROR_WRITE_FILE = -106
Basic error codes
  • Since: 0.3.3

[ Top ]



Documentation generated on Mon, 11 Mar 2019 10:16:41 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.