Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Tab  /  Tabbody   Login nu   Login
blank.gif
««« Se kilde koden
blank.gif
tl.gif Base tr.gif tl.gif Basic tr.gif tl.gif Dto tr.gif tl.gif Form tr.gif tl.gif Language tr.gif tl.gif Layout tr.gif tl.gif Menu tr.gif tl.gif Mvc tr.gif tl.gif Netbank.eksperter.dk tr.gif tls.gif     Tab  trs.gif tl.gif Table tr.gif tl.gif Util tr.gif
blank.gif
blank.gif
arrow-headline.gif Index
MenuLink  MenuLeft  
Tilbage

Skjul: Navn

TabBody.php


Vis: Sample code, tutorial

TabBody, Sample code, tutorial

Sådan benyttes komponenten TabBody klassen

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

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

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

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

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

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

Skjul: Sådan vises komponenten

TabBody, Sådan vises komponenten

Sådan vises komponenten TabBody klassen


Vis: PHP source code

TabBody, PHP source code

Den fulde PHP kildekode for TabBody klassen

<?php
/**
 * @package tab
 * @see HTML_TAB_PAGE_PATH.'/TabBody.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_TABLE_COMPONENT_PATH.'/TableHeader.php');
require_once(
HTML_TABLE_COMPONENT_PATH.'/Table.php');

/**
 * Generates a Tab navigation menu
 * <code>
 *  ______________+-------+_________________
 * | link1 |link2 | link3 | link4 |         |
 * +--------------+       +-----------------+
 * |                                        |
 * |         Tab Body                       |
 * |                                        |
 * +-------- tab end -----------------------+
 * Usage:
 *   $datareader  = null;
 *   $text        = "Text header";
 *   $width       = "100%";
 *   $class       = "theTable";
 *   $border      = "1";
 *   $cellpadding = "5"
 *   $cellspacing = "0";
 *   $summary     = "";
 *   $caption     = "";
 *   $id          = "";
 *   
 *   $html = new TabBody($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $id);
 *   print $html->getStart();
 *   print "The tab body";
 *   print $html->getEnd();
 * Or
 *   TabBody::start($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $id);
 *   Raw::display"The tab body");
 *   TabBody::end();
 * Or
 *   TabBody::display($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $id);
 * </code>
 * @package tab
 */

class TabBody extends Table {
    
/**
     * Constructor
     * @param DataReader / array $datareader The Data Reader object OR an array
     * @param String $text    The text header for the table
     * @param String $width   The Width for the table
     * @param String $class   The Class
     * @param String $border  The Border
     * @param String $cellpadding The CellSpacing
     * @param String $cellspacing The CellPadding
     * @param String $summary The Summary
     * @param String $caption The Caption 
     */
    
function __construct($datareader=null$text=''$width=''$class=''$border=''$cellpadding=''$cellspacing=''$summary=''$caption=''$id='') {
        
$theText    $text   != '' $text   '';
        
$theWidth   $width  != '' $width  TAB_BODY_WIDTH;
        
$theClass   $class  != '' $class  TAB_BODY_CLASS;
        
$theBorder  $border != '' $border TAB_BODY_BORDER;
        
$theId      $id     != '' $id     $this->getClassName()."Id";
        
$thePadding $cellpadding != '' $cellpadding TAB_BODY_CELL_PADDING;
        
$theSpacing $cellspacing != '' $cellspacing TAB_BODY_CELL_SPACING;
        
parent::__construct($datareader$theText$theWidth$theClass$theBorder$thePadding$theSpacing$summary$caption$theId);
    }

    
/**
     * Get the content as an object 
     * @return Object The content
     */
    
function newContent() {
        
$object = new Tr();
        
$object->add(new Td(CSS_TAB_BODY));
        return 
$object;
    }
    
    
/**
     * Builds the html for a Tab menu, and return it 
     * @return String The tab menu as html
     */
    
function getHtml() {
        
$html $this->html;
        if (
defined('TAB_SHOW') && TAB_SHOW TAB_SHOW_MENU_TAB) {
            if (
CACHE_TAB && $this->getCacheFileName(CACHE_TAB_PATH) != '' && file_exists($this->getCacheFileName(CACHE_TAB_PATH))) {
                
$html .= $this->content($this->getCacheFileName(CACHE_TAB_PATH));
            } else {
                
$this->add($this->newContent());
                
// Render it
                
if ($this->text != '') {
                    
$html .= $this->getTableHeader();
                }
                
$html .= $this->getStart();
                
$html .= $this->getEnd();
                if (
CACHE_TAB) {
                    
$this->save($htmlCACHE_TAB_PATH);
                }
            }
        }
        return 
$html;
    }

    
/**
     * Get the start of the table tag
     * <code>
     * Usage:
     *    TableBody::start($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $id); 
     * </code>
     * @static
     * @param DataReader / array $datareader The Data Reader object OR an array
     * @param String $text    The text header for the table
     * @param String $width   The Width for the table
     * @param String $class   The Class
     * @param String $border  The Border
     * @param String $cellpadding The CellSpacing
     * @param String $cellspacing The CellPadding
     * @param String $summary The Summary
     * @param String $caption The Caption 
     * @param String $id      The element ID
     */
    
public static function start($datareader=null$text=''$width=''$class=''$border=''$cellpadding=''$cellspacing=''$summary=''$caption=''$id='') {
        
$html = new TabBody($datareader$text$width$class$border$cellpadding$cellspacing$summary$caption$id);
        if (
$text != '') {
             
$html->addHtml($html->getTableHeader());
        }
        
$html->addHtml($html->getStart());
        
// Note: you must write the start TR + TD your self
    
}

    
/**
     * Get the end of the table tag
     * <code>
     * Usage:
     *    TableBody::end($type);
     * </code>
     * @static
     */
    
public static function end() {
        
$html = new TabBody();
        
// Note: you must write the end TD + TR your self
        
$html->addHtml($html->getEnd());
    }

    
/**
     * Display the html
     * <code>
     * Usage:
     *    TabBody::display($datareader, $text, $width, $class, $border, $cellpadding, $cellspacing, $summary, $caption, $id);
     * </code>
     * @static
     * @param DataReader / array $datareader The Data Reader object OR an array
     * @param String $text    The text header for the table
     * @param String $width   The Width for the table
     * @param String $class   The Class
     * @param String $border  The Border
     * @param String $cellpadding The CellSpacing
     * @param String $cellspacing The CellPadding
     * @param String $summary The Summary
     * @param String $caption The Caption 
     * @param String $id      The element ID
     */
    
public static function display($datareader=null$text=''$width=''$class=''$border=''$cellpadding=''$cellspacing=''$summary=''$caption=''$id='') {
        
$html = new TabBody($datareader$text$width$class$border$cellpadding$cellspacing$summary$caption$id);
        
$html->addHtml();
    }
}
?>

Vis: HTML source code

TabBody, HTML source code

Den fulde HTML kildekode for TabBody klassen

<?
<!-- DEBUGTabBody -->

<
table id="TabBodyId" width="100%" class="baseNONE" border="0" cellpadding="5" cellspacing="0">
 <
tr>
    <
td class="tabTabBody" valign="top"></td>
 </
tr>

</
table>

?>

Vis: Class methods

TabBody, Class methods

Her er 'klasse metoderne' for TabBody klassen:

  • __construct
  • newContent
  • getHtml
  • start
  • end
  • display
  • newTextRow
  • getTableHeader
  • getStart
  • getEnd
  • setObject
  • set
  • get
  • getAttribute
  • getTag
  • add
  • getSizeof
  • getElement
  • getElements
  • getToogle
  • getMaximize
  • getMinimize
  • newTriangle
  • getStartHtml
  • getEndHtml
  • showsource
  • getClassName
  • getMsg
  • addHtml
  • __toString
  • getCacheFileName
  • save
  • content

Vis: Object vars

TabBody, Object vars

Her er 'objekt variable' for TabBody klassen:

  • html =>
  • sql =>

MenuRight 
triangle.gif

Dansk

Deutch

English (UK)

France

Italy

Norsk

Svensk

English (USA)


 
blank.gif
MenuBottom 
triangle.gif Copyright @ 1999-2010 www.Finn-Rasmussen.com Powered by myPHP Version (5.3.3-7+squeeze3) 1.11
blank.gif