|
|
TilbageNavn : CssTable.php
Sample code, tutorial
Sådan benyttes komponenten CssTable klassen
Først skal du inkludere den fil der beskriver komponenten, som en klasse fil
<?
require_once(HTML_PACKAGE_PATH.'/CssTable.php');
?>
Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):
<?
CssTable::display($param1, $param2, $param3, ...);
?>
eller du kan lave en instance af komponenten og benytte metoderne direkte:
<?
$object = new CssTable($param1, $param2, $param3, ...);
print $object->getHtml();
?>
Parent html
Sådan vises komponenten CssTable klassen
PHP source code
Den fulde PHP kildekode for CssTable klassen
<?
/**
* @package table
* @filesource
* @see HTML_TABLE_PAGE_PATH.'/CssTable.php'
* @copyright (c) http://Finn-Rasmussen.com
* @license http://Finn-Rasmussen.com/license/ myPHP License conditions
* @author http://Finn-Rasmussen.com
* @version 1.10
* @since 22-feb-2007
*/
/**
* The required files
*/
require_once(HTML_BASE_PAGE_PATH.'/Css.php');
/**
* Generates the Table CSS
* <code>
* Usage:
* $css = new CssTable($href);
* print $css->getHtml();
* Or:
* CssTable::display($href);
* </code>
* @package table
*/
class CssTable extends Css {
/**
* Constructor
* @param String $href The url to the css filename (i.e. /css/my.css)
*/
function CssTable($href='') {
$this->Css($href!=''?$href:CSS_FILE_NAME_TABLE);
}
/**
* Returns the css Table components
* @return String the complete css
*/
function getCustom() {
$html = '';
$html .= $this->getHeader($this->getClassName());
$html .= $this->getComponent('.'.CSS_SKELETON_LEFT ,CSS_SKELETON_LEFT_COLOR ,CSS_SKELETON_LEFT_BACKGROUND,'','','',CSS_SKELETON_WIDTH_LEFT);
$html .= $this->getComponent('.'.CSS_SKELETON_CENTER,CSS_SKELETON_CENTER_COLOR,CSS_SKELETON_CENTER_BACKGROUND);
$html .= $this->getComponent('.'.CSS_SKELETON_RIGHT ,CSS_SKELETON_RIGHT_COLOR ,CSS_SKELETON_RIGHT_BACKGROUND,'','','',CSS_SKELETON_WIDTH_RIGHT);
$html .= $this->getBorderSingle('.'.CSS_BORDER_LEFT ,'left' ,'',CSS_1PX,CSS_BORDER_STYLE_SOLID);
$html .= $this->getBorderSingle('.'.CSS_BORDER_RIGHT ,'right' ,'',CSS_1PX,CSS_BORDER_STYLE_SOLID);
$html .= $this->getBorderSingle('.'.CSS_BORDER_TOP ,'top' ,'',CSS_1PX,CSS_BORDER_STYLE_SOLID);
$html .= $this->getBorderSingle('.'.CSS_BORDER_BOTTOM ,'bottom' ,'',CSS_1PX,CSS_BORDER_STYLE_SOLID);
// Different Views
$html .= $this->getClass('.'.CSS_BASKET_VIEW, CSS_BASKET_VIEW_COLOR ,CSS_BASKET_VIEW_BACKGROUND);
$html .= $this->getClass('.'.CSS_BASKET_INVOICE_VIEW, CSS_BASKET_INVOICE_VIEW_COLOR ,CSS_BASKET_INVOICE_VIEW_BACKGROUND);
$html .= $this->getClass('.'.CSS_INFO_VIEW, CSS_INFO_VIEW_COLOR ,CSS_INFO_VIEW_BACKGROUND);
$html .= $this->getClass('.'.CSS_BUSINESS_CARD_VIEW, CSS_BUSINESS_CARD_VIEW_COLOR ,CSS_BUSINESS_CARD_VIEW_BACKGROUND);
//$html .= $this->getClass('.'.CSS_PAGE_VIEW, CSS_PAGE_VIEW_COLOR ,CSS_PAGE_VIEW_BACKGROUND);
$html .= $this->getClass('.'.CSS_LIST_VIEW, CSS_LIST_VIEW_COLOR ,CSS_LIST_VIEW_BACKGROUND);
//$html .= $this->getClass('.'.CSS_SHOW_VIEW, CSS_SHOW_VIEW_COLOR ,CSS_SHOW_VIEW_BACKGROUND);
$html .= $this->getClass('.'.CSS_FORM_VIEW, CSS_FORM_VIEW_COLOR ,CSS_FORM_VIEW_BACKGROUND);
//$html .= $this->getClass('.'.CSS_SEARCH_VIEW, CSS_SEARCH_VIEW_COLOR ,CSS_SEARCH_VIEW_BACKGROUND);
//$html .= $this->getClass('.'.EMAIL_VIEW_CLASS, CSS_EMAIL_VIEW_COLOR ,CSS_EMAIL_VIEW_BACKGROUND);
//$html .= $this->getBorder('.'.EMAIL_VIEW_CLASS);
return $html;
}
/**
* Display html
* <code>
* Usage:
* CssTable::display($href);
* </code>
* @static
* @param String $href The url to the css file (i.e. /css/my.css)
*/
function display($href='') {
$html = new CssTable($href);
$html->addHtml();
}
}
?>
HTML source code
Den fulde HTML kildekode for CssTable klassen
<?
<style type="text/css">
/**
* Autocreated css cache file
* @description Csstable
* @file /cache/css/finnrasmussen.dk-table.css
* @copyright (c) http://Finn-Rasmussen.com
* @author http://Finn-Rasmussen.com
* @date 25-Jul-2008 18:29:06
* @note The url(/images/filename.gif) must be located here
*/
.tableSkeletonLeft{color:#000;background-color:#fff;width:200px;}
a:link.tableSkeletonLeft,a:visited.tableSkeletonLeft,a:active.tableSkeletonLeft{color:#000;background-color:#fff;font-size:11px;font-weight:bold;text-decoration:underline;}
a:hover.tableSkeletonLeft{color:#fff;background-color:#000;font-size:11px;font-weight:bold;text-decoration:underline;}
img.tableSkeletonLeft{color:#fffffe;background-color:#fff;border-style:none;}
.tableSkeletonCenter{color:#000;background-color:#fff;}
a:link.tableSkeletonCenter,a:visited.tableSkeletonCenter,a:active.tableSkeletonCenter{color:#000;background-color:#fff;font-size:11px;font-weight:bold;text-decoration:underline;}
a:hover.tableSkeletonCenter{color:#fff;background-color:#000;font-size:11px;font-weight:bold;text-decoration:underline;}
img.tableSkeletonCenter{color:#fffffe;background-color:#fff;border-style:none;}
.tableSkeletonRight{color:#000;background-color:#fff;width:36px;}
a:link.tableSkeletonRight,a:visited.tableSkeletonRight,a:active.tableSkeletonRight{color:#000;background-color:#fff;font-size:11px;font-weight:bold;text-decoration:underline;}
a:hover.tableSkeletonRight{color:#fff;background-color:#000;font-size:11px;font-weight:bold;text-decoration:underline;}
img.tableSkeletonRight{color:#fffffe;background-color:#fff;border-style:none;}
.tableBorderLeft{border-left-color:#000;border-left-width:1px;border-left-style:solid;}
.tableBorderRight{border-right-color:#000;border-right-width:1px;border-right-style:solid;}
.tableBorderTop{border-top-color:#000;border-top-width:1px;border-top-style:solid;}
.tableBorderBottom{border-bottom-color:#000;border-bottom-width:1px;border-bottom-style:solid;}
.tableBasketView{color:#000;background-color:#fff;}
.tableBasketInvoiceView{color:#000;background-color:#fff;}
.tableInfoView{color:#000;background-color:#fff;}
.tableBusinessCardView{color:#000;background-color:#fff;}
.tableListView{color:#000;background-color:#fff;}
.formView{color:#000;background-color:#fff;}
</style>
?>
Class methods
Her er 'klasse metoderne' for CssTable klassen:
- object
- getclassname
- getmsg
- addhtml
- gethtml
- tostring
- getcachefilename
- save
- content
- html
- setobject
- set
- get
- getattribute
- gettag
- add
- getsizeof
- getelement
- getelements
- gettoogle
- getmaximize
- getminimize
- newtriangle
- display
- showsource
- css
- getlink
- getlinknormal
- getlinkhover
- getlinkimage
- getimage
- getcomponent
- getborderline
- getbordersingle
- getborder
- gettab
- gettabactive
- gettabbody
- getbutton
- getclass
- getli
- getsingle
- getcssarray
- gethidden
- gethr
- getwidth
- getstart
- getcss
- getfieldset
- getlegend
- getselect
- getend
- getheader
- getinline
- getcustom
- csstable
Object vars
Her er 'objekt variable' for CssTable klassen:
- html =>
- sql =>
- elements => Array
- sizeof => 0
- href => table.css
|
|