Sådan benyttes komponenten CssLayout klassen
Først skal du inkludere den fil der beskriver komponenten, som en klasse fil
<? require_once(HTML_PACKAGE_PATH.'/CssLayout.php'); ?>
Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):
<? CssLayout::display($param1, $param2, $param3, ...); ?>
eller du kan lave en instance af komponenten og benytte metoderne direkte:
<? $object = new CssLayout($param1, $param2, $param3, ...); print $object->getHtml(); ?>
Sådan vises komponenten CssLayout klassen
Den fulde PHP kildekode for CssLayout klassen
<?php/** * @package layout * @see HTML_LAYOUT_PAGE_PATH.'/CssLayout.php' * @copyright (c) http://Finn-Rasmussen.com * @license http://Finn-Rasmussen.com/license/ myPHP License conditions * @author http://Finn-Rasmussen.com * @version 1.11 * @since 27-nov-2009 *//** * The required files */require_once(HTML_BASE_PAGE_PATH.'/Css.php');/** * Generates the Layout CSS * <code> * Usage: * $href = "layout.css"; * $css = new CssLayout($href); * print $css->getHtml(); * Or: * CssLayout::display($href); * </code> * @package layout */class CssLayout extends Css { /** * Constructor * @param String $href The url to the css filename (i.e. layout.css) */ function __construct($href='') { parent::__construct($href != '' ? $href : CSS_FILE_NAME_LAYOUT); } /** * Returns the css Table components * @return String the complete css */ function getCustom() { $html = ''; $html .= $this->getHeader($this->getClassName()); $html .= $this->getComponent('.'.CSS_BANNER ,CSS_BANNER_COLOR ,CSS_BANNER_BACKGROUND,'','',CSS_TEXT_DECORATION_NONE); // CSS_FONTSIZE_SIZE_MEDIUM $bar0 = new Images(IMAGE_BAR0); $bar1 = new Images(IMAGE_BAR1); $bar2 = new Images(IMAGE_BAR2); $bar3 = new Images(IMAGE_BAR3); $logo = new Images(IMAGE_LOGO); $html .= $this->getClass('.'.CSS_LINE ,CSS_LINE_COLOR,CSS_LINE_BACKGROUND); $html .= $this->getClass('.'.CSS_LINE_BANNER ,CSS_LINE_BANNER_COLOR,CSS_LINE_BANNER_BACKGROUND,'','', $bar0->get('src') ,CSS_BACKGROUND_REPEAT_X); $html .= $this->getClass('.'.CSS_LINE_LOCATOR,CSS_LINE_LOCATOR_COLOR,CSS_LINE_LOCATOR_BACKGROUND,'','', $bar2->get('src'),CSS_BACKGROUND_REPEAT_X); $html .= $this->getCssTag('.'.CSS_VOWELS , CSS_VOWELS_COLOR ,CSS_VOWELS_BACKGROUND,'','32px'); $html .= $this->getCssTag('.'.CSS_NON_VOWELS, CSS_NON_VOWELS_COLOR ,CSS_NON_VOWELS_BACKGROUND,'','32px'); // //$html .= $this->getComponent('.'.CSS_BANNERIF ,CSS_BANNERIF_COLOR ,CSS_BANNERIF_BACKGROUND,CSS_FONTSIZE_SIZE_MEDIUM); $html .= $this->getComponent('.'.CSS_BRANDING ,CSS_BRANDING_COLOR ,CSS_BRANDING_BACKGROUND); $html .= $this->getComponent('.'.CSS_CANVAS ,CSS_CANVAS_COLOR ,CSS_CANVAS_BACKGROUND); $html .= $this->getComponent('.'.CSS_COPYRIGHT ,CSS_COPYRIGHT_COLOR ,CSS_COPYRIGHT_BACKGROUND,CSS_FONTSIZE_SIZE_XXSMALL,'',CSS_TEXT_DECORATION_NONE); $html .= $this->getComponent('.'.CSS_COMPANY ,CSS_COMPANY_COLOR ,CSS_COMPANY_BACKGROUND); //$html .= $this->getComponent('.'.CSS_CUSTOMER ,CSS_CUSTOMER_COLOR ,CSS_CUSTOMER_BACKGROUND); //$html .= $this->getComponent('.'.CSS_FIRMA ,CSS_FIRMA_COLOR ,CSS_FIRMA_BACKGROUND); $html .= $this->getComponent('.'.CSS_LOCATOR ,CSS_LOCATOR_COLOR ,CSS_LOCATOR_BACKGROUND ,'','',CSS_TEXT_DECORATION_NONE); //$html .= $this->getComponent('.'.CSS_FOOTER ,CSS_FOOTER_COLOR ,CSS_FOOTER_BACKGROUND); $html .= $this->getComponent('.'.CSS_TOP ,CSS_TOP_COLOR ,CSS_TOP_BACKGROUND,'','',CSS_TEXT_DECORATION_NONE); //$html .= $this->getComponent('.'.CSS_ENIRO_BANNER ,CSS_ENIRO_BANNER_COLOR ,CSS_ENIRO_BANNER_BACKGROUND,'','',CSS_TEXT_DECORATION_NONE); // $html .= $this->getImage('.'.CSS_BANNERIF, $logo->get('src'),CSS_REPEAT_NO); // Bugfix for Firefox $html .= $this->getSingle('.'.CSS_BANNER ,'white-space','nowrap'); $html .= $this->getSingle('.'.CSS_BRANDING,'white-space','nowrap'); $html .= $this->getSingle('.'.CSS_COMPANY ,'white-space','nowrap'); $html .= $this->getSingle('.'.CSS_LOCATOR ,'white-space','nowrap'); $html .= $this->getSingle('.'.CSS_TOP ,'white-space','nowrap'); return $html; } /** * Display html * <code> * Usage: * $href = "layout.css"; * CssLayout::display($href); * </code> * @static * @param String $href, The url to the css file (i.e. layout.css) */ public static function display($href='') { $html = new CssLayout($href); $html->addHtml(); }}?>
Den fulde HTML kildekode for CssLayout klassen
<? <!-- DEBUG: CssLayout --> <style type="text/css"> /*********************************************************** * * AUTOGENERATED file, DO NOT CHANGE OR EDIT, the full source code is here _____________________________________________________ ________| |________ \ | http://Finn-Rasmussen.com Phone (+45) 40 50 60 69 | / \ | Kongens Vænge 79, 3400 Hillerød, Denmark | / / |_____________________________________________________| \ /___________) (__________\ * * @version : 1.11 * @since : 19-May-2012 19:54:57 * @copyright : Copyright © 1999-2010 http://Finn-Rasmussen.com * * Email : Please, phone me for my email address * Web : http://Finn-Rasmussen.com * : This website was created by the myPHP taglib and CMS * : Download a free demo of the myPHP taglib here ... * : http://Finn-Rasmussen.com/myPHP/ * @domain : myrer.info * @language : da * @webmaster : DEFAULT_CMS_LOGIN_USERNAME(+)myrer.info * @file : /cache/files/myrer.info-layout.css (Autocreated cache file) * @classname : CssLayout ***********************************************************/ .layoutBanner{ color : #000; background-color : #ccc; } a:link.layoutBanner,a:visited.layoutBanner,a:active.layoutBanner{ color : #000; background-color : #ccc; font-size : 11px; font-weight : bold; text-decoration : none; } a:hover.layoutBanner{ color : #ccc; background-color : #000; font-size : 11px; font-weight : bold; text-decoration : none; } img.layoutBanner{ color : #cccccd; background-color : #ccc; border-style : none; } .layoutLine{ color : #000; background-color : #ccc; } .layoutLineBanner{ color : #000; background-color : #ccc; background-image : url('http://myrer.info/images/bar0.gif'); background-repeat : repeat-x; } .layoutLineLocator{ color : #000; background-color : #ccc; background-image : url('http://myrer.info/images/bar2.gif'); background-repeat : repeat-x; } .layoutVowels{ color : #f00; background-color : #ccc; font-size : 32px; } .layoutNonVowels{ color : #00f; background-color : #ccc; font-size : 32px; } .layoutBranding{ color : #000; background-color : #ccc; } a:link.layoutBranding,a:visited.layoutBranding,a:active.layoutBranding{ color : #000; background-color : #ccc; font-size : 11px; font-weight : bold; text-decoration : underline; } a:hover.layoutBranding{ color : #ccc; background-color : #000; font-size : 11px; font-weight : bold; text-decoration : underline; } img.layoutBranding{ color : #cccccd; background-color : #ccc; border-style : none; } .baseCanvas{ color : #000; background-color : #ddd; } a:link.baseCanvas,a:visited.baseCanvas,a:active.baseCanvas{ color : #000; background-color : #ddd; font-size : 11px; font-weight : bold; text-decoration : underline; } a:hover.baseCanvas{ color : #ddd; background-color : #000; font-size : 11px; font-weight : bold; text-decoration : underline; } img.baseCanvas{ color : #ddddde; background-color : #ddd; border-style : none; } .layoutCopyright{ color : #000; background-color : #ccc; } a:link.layoutCopyright,a:visited.layoutCopyright,a:active.layoutCopyright{ color : #000; background-color : #ccc; font-size : xx-small; font-weight : bold; text-decoration : none; } a:hover.layoutCopyright{ color : #ccc; background-color : #000; font-size : xx-small; font-weight : bold; text-decoration : none; } img.layoutCopyright{ color : #cccccd; background-color : #ccc; border-style : none; } .layoutCompany{ color : #000; background-color : #fff; } a:link.layoutCompany,a:visited.layoutCompany,a:active.layoutCompany{ color : #000; background-color : #fff; font-size : 11px; font-weight : bold; text-decoration : underline; } a:hover.layoutCompany{ color : #fff; background-color : #000; font-size : 11px; font-weight : bold; text-decoration : underline; } img.layoutCompany{ color : #fffffe; background-color : #fff; border-style : none; } .layoutLocator{ color : #000; background-color : #ccc; } a:link.layoutLocator,a:visited.layoutLocator,a:active.layoutLocator{ color : #000; background-color : #ccc; font-size : 11px; font-weight : bold; text-decoration : none; } a:hover.layoutLocator{ color : #ccc; background-color : #000; font-size : 11px; font-weight : bold; text-decoration : none; } img.layoutLocator{ color : #cccccd; background-color : #ccc; border-style : none; } .layoutTop{ color : #000; background-color : #ccc; } a:link.layoutTop,a:visited.layoutTop,a:active.layoutTop{ color : #000; background-color : #ccc; font-size : 11px; font-weight : bold; text-decoration : none; } a:hover.layoutTop{ color : #ccc; background-color : #000; font-size : 11px; font-weight : bold; text-decoration : none; } img.layoutTop{ color : #cccccd; background-color : #ccc; border-style : none; } .layoutBannerIF{ background-image : url('/myphp-1.11/myphp-1.11-netbank.eksperter.dk/html/images/netbank.eksperter.dk-logo.gif'); background-repeat : no-repeat; } .layoutBanner{ white-space : nowrap; } .layoutBranding{ white-space : nowrap; } .layoutCompany{ white-space : nowrap; } .layoutLocator{ white-space : nowrap; } .layoutTop{ white-space : nowrap; } /* DEBUG, Not cached, CSS Custom file : /cache/css/myrer.info-layout.css */ </style> ?>
Her er 'klasse metoderne' for CssLayout klassen:
Her er 'objekt variable' for CssLayout klassen: