blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Tab  /  Tabbody   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 : TabBody.php


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();
    ?>

Parent html

Sådan vises komponenten TabBody klassen

 

PHP source code

Den fulde PHP kildekode for TabBody klassen

<?
/**
* @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.10
* @since 22-feb-2007
*/

/**
* 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:
*   $html = new TabBody($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
*   print $html->getStart();
*   print "The tab body";
*   print $html->getEnd();
* Or
*   TabBody::start($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
*   Raw::display"The tab body");
*   TabBody::end();
* Or
*   TabBody::display($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
* </code>
* @package tab
*/

class TabBody extends Table {
    
/**
     * Constructor
     * @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 TabBody($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
        
$theText    = $text!=''?$text:'';
        
$theWidth   = $width!=''?$width:TAB_BODY_WIDTH;
        
$theClass   = $class!=''?$class:TAB_BODY_CLASS;
        
$theBorder  = $border!=''?$border:TAB_BODY_BORDER;
        
$thePadding = $cellpadding!=''?$cellpadding:TAB_BODY_CELL_PADDING;
        
$theSpacing = $cellspacing!=''?$cellspacing:TAB_BODY_CELL_SPACING;
        
$this->Table($theText,$theWidth,$theClass,$theBorder,$thePadding,$theSpacing,$summary,$caption);
    }

    
/**
     * 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($html, CACHE_TAB_PATH);
                }
            }
        }
        return
$html;
    }

    
/**
     * Get the start of the table tag
     * <code>
     * Usage:
     *    TableBody::start($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
     * </code>
     * @static
     * @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 start($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
        
$html = new TabBody($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
        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
     */
    
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($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
     * </code>
     * @static
     * @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 display($text='',$width='',$class='',$border='',$cellpadding='',$cellspacing='',$summary='',$caption='') {
        
$html = new TabBody($text,$width,$class,$border,$cellpadding,$cellspacing,$summary,$caption);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for TabBody klassen

<?

<table width="100%" class="baseNONE" border="0" cellpadding="5" cellspacing="0">
<
tr>
    <
td class="layoutTabBody" valign="top">&nbsp;</td>
</
tr>

<
tr>
    <
td class="layoutTabBody" valign="top">&nbsp;</td>
</
tr>

</
table>

?>

Class methods

Her er 'klasse metoderne' for TabBody 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
  • tabbody
  • newcontent

Object vars

Her er 'objekt variable' for TabBody klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 2
  • text =>
  • width => 100%
  • class => baseNONE
  • border => 0
  • cellpadding => 5
  • cellspacing => 0
  • summary =>
  • caption =>

 
triangle.gif

danmark

Germany

England

France

Italy

Norge

Sverige

USA


 
blank.gif