blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Layout  /  Line   Login nu   Login
blank.gif
 ««« Se kilde koden
blank.gif
triangle.gif Basic Base Component Db Dto Form Form-elements Jquery Layout  Menu Menu-fisheye Mvc Tab Table Template Util
blank.gif
blank.gif
 
arrow-headline.gif Index
 
  Tilbage

Navn : Line.php


Sample code, tutorial

Sådan benyttes komponenten Line klassen

Først skal du inkludere den fil der beskriver komponenten, som en klasse fil

  • <?
    require_once(HTML_PACKAGE_PATH.'/Line.php');
    ?>

Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):

  • <?
    Line
    ::display($param1, $param2, $param3, ...);
    ?>

eller du kan lave en instance af komponenten og benytte metoderne direkte:

  • <?
    $object
    = new Line($param1, $param2, $param3, ...);
    print
    $object->getHtml();
    ?>

Parent html

Sådan vises komponenten Line klassen

blank.gif

PHP source code

Den fulde PHP kildekode for Line klassen

<?
/**
* @package layout
* @see HTML_LAYOUT_UTIL_PATH.'/Line.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_TABLE_COMPONENT_PATH.'/TableHeader.php');
require_once(
HTML_TABLE_COMPONENT_PATH.'/Table.php');
require_once(
HTML_BASE_UTIL_PATH.'/Images.php');

/**
* Used to draw a line, in order to show some visual effects
* <code>
* Usage:
*   $line = new Line($height,$text,$width,$height,$class,$border,$cellPadding,$cellSpacing);
*   print $line->getHtml();
* Or
*   Line::display($height,$text,$width,$class,$border,$cellPadding,$cellSpacing);
* </code>
* @package layout
*/

class Line extends Table {
   var
$height    = '';
   var
$lineclass = '';

   
/**
    * Constructor
    * @param String $height The height of the line
    * @param String $text   The text header for the table
    * @param String $width  The width of the table, default 100%
    * @param String $class  The css class to use
    * @param String $border The table border
    * @param String $cellPadding
    * @param String $cellSpacing
    */
   
function Line($height='',$text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
        
$theText   = $text!=''?$text:'';
        
$theWidth  = $width!=''?$width:LINE_VIEW_WIDTH;
        
$theBorder = $border!=''?$border:LINE_VIEW_BORDER;
        
$theCellPadding = $cellPadding!=''?$cellPadding:LINE_VIEW_CELLPADDING;
        
$theCellSpacing = $cellSpacing!=''?$cellSpacing:LINE_VIEW_CELLSPACING;
        
$this->Table($theText,$theWidth,CSS_PRINTER,$theBorder,$theCellPadding,$theCellSpacing);
          
$this->height    = $height!=''?$height:LINE_VIEW_HEIGHT;
        
$this->lineclass = $class!=''?LINE_VIEW_CLASS.' '.$class:LINE_VIEW_CLASS;
   }

    
/**
     * Get the CSS class Name for this component
     * @return String The CSS class name
     */
    
function getCssClass() {
        return
$this->lineclass;
    }

    
/**
     * Return the content as an object
     * @return Object The content as an object
     */
    
function newContent() {
        
$tr = new Tr();
        
$img = new Images(IMAGE_BLANK,$this->width,$this->height);
        
$td = new Raw('<td class="'.$this->getCssClass().'">'.$img->getHtml().'</td>');
        
$tr->add($td);
        return
$tr;
    }

   
/**
    * Builds the html, and return it for a Line object
    * @return String The html
    */
   
function getHtml() {
      
$html  = $this->html;
      if (
defined('LAYOUT_SHOW') && LAYOUT_SHOW & LAYOUT_SHOW_LINE && HTTP_USER_AGENT!=HTTP_USER_AGENT_P900) {
        
$this->add($this->newContent());
        
// Render it
        
if ($this->text != '') {
            
$html .= $this->getTableHeader();
        }
        
$html .= $this->getStart();
        
$html .= $this->getEnd();
      }
      return
$html;
   }

   
/**
    * Display html
    * <code>
    * Usage:
    *    Line::display($height,$text,$width,$class,$border,$cellPadding,$cellSpacing);
    * </code>
    * @static
    * @param String $height The height of the line
    * @param String $text   The text header for the table
    * @param String $width  The width of the table, default 100%
    * @param String $class  The css class to use
    * @param String $border The table border
    * @param String $cellPadding
    * @param String $cellSpacing
    */
   
function display($height='',$text='',$width='',$class='',$border='',$cellPadding='',$cellSpacing='') {
      
$html = new Line($height,$text,$width,$class,$border,$cellPadding,$cellSpacing);
      
$html->addHtml();
   }
}
?>

HTML source code

Den fulde HTML kildekode for Line klassen

<?

<table width="100%" class="basePrinter" border="0" cellpadding="0" cellspacing="0">
<
tr>
<
td class="tableBorderLeft tableBorderRight basePrinter layoutLineBanner"><img src="/images/blank.gif" width="100%" height="5px" alt="blank.gif" /></td>
</
tr>

<
tr>
<
td class="tableBorderLeft tableBorderRight basePrinter layoutLineBanner"><img src="/images/blank.gif" width="100%" height="5px" alt="blank.gif" /></td>
</
tr>

</
table>

?>

Class methods

Her er 'klasse metoderne' for Line 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
  • table
  • newtextrow
  • gettableheader
  • getstart
  • getend
  • start
  • end
  • line
  • getcssclass
  • newcontent

Object vars

Her er 'objekt variable' for Line klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 2
  • text =>
  • width => 100%
  • class => basePrinter
  • border => 0
  • cellpadding => 0
  • cellspacing => 0
  • summary =>
  • caption =>
  • height => 5px
  • lineclass => tableBorderLeft tableBorderRight basePrinter layoutLineBanner

 
triangle.gif

danmark

Germany

England

France

Italy

Norge

Sverige

USA


 
blank.gif