Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Tab  /  Indexmenu   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

IndexMenu.php


Vis: Sample code, tutorial

IndexMenu, Sample code, tutorial

Sådan benyttes komponenten IndexMenu klassen

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

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

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

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

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

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

Skjul: Sådan vises komponenten

IndexMenu, Sådan vises komponenten

Sådan vises komponenten IndexMenu klassen

0) text=>Oversigt href=>http://finnrasmussen.dk/source-code/tab aux=>16 class=> title=>Klik her for at se oversigten ...
1) text=>Message href=>http://finnrasmussen.dk/source-code/tab/Message aux=>16
2) text=>MessageList href=>http://finnrasmussen.dk/source-code/tab/MessageList aux=>16
3) text=>Redirect href=>http://finnrasmussen.dk/source-code/tab/Redirect aux=>16
4) text=>Rowcolor href=>http://finnrasmussen.dk/source-code/tab/Rowcolor aux=>16
5) text=>Singleton href=>http://finnrasmussen.dk/source-code/tab/Singleton aux=>16

Vis: PHP source code

IndexMenu, PHP source code

Den fulde PHP kildekode for IndexMenu klassen

<?php
/**
 * @package tab
 * @see HTML_TAB_PAGE_PATH/IndexMenu.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_UTIL_COMPONENT_PATH.'/Request.php');

/**
 * Generates a list of links, like in an Index
 * <code>
 * Usage:
 *   $documents = array('Message','MessageList','Redirect','Rowcolor','Singleton',);
 *   $indexMenuLinks = IndexMenu:links($documents);
 * Or
 *   $file = IndexMenu::file($PACKAGES);
 * </code>
 * @package tab
 */

class IndexMenu {
    
/**
     * Constructor
     */
    
function __construct() {
    }


    
/**
     * Get the filename name for the Index source code
     * The global package name is expected
     * @see $PACKAGES
     * <code>
     * Usage:
     *    $phpFile = DEFAULT_CONTENT_FILE_NAME;
     *    $file = IndexMenu::file($PACKAGES, $phpFile);
     * </code>
     * @static
     * @param  array  $packages The array of packages
     * @param  String $phpFile  The php filename to use
     * @return String The filename to include or empty if not found
     */
    
public static function file($packages$phpFile) {
        
$filename '';
        
$indexSourceCode defined('INDEX_DEFAULT')?INDEX_DEFAULT:"";
        
$tabSourceCode   TAB_INDEX;
        if (
defined('TAB_SHOW') && TAB_SHOW TAB_SHOW_URL) {
            
$indexSourceCode Request::get(REQUEST_INDEXdefined('INDEX_DEFAULT')?INDEX_DEFAULT:"");
            
$tabSourceCode   Request::get(REQUEST_TABTAB_INDEX);
        }
        foreach(
$packages as $key=>$package) {
            if (
defined($package)) {
                
$path constant($package);
                if (
MYPHP_RUNTIME != '') {
                    
// Use the real software as path
                    
$path str_replace(MYPHP_RUNTIME''$path);
                }
                
$file $path.DEFAULT_HTML_DOC_PATH.($indexSourceCode != ''?"$indexSourceCode":'')."/".$phpFile;
                if (
file_exists($file)) {
                    
//print "OK exists $file<br />";
                    //$file = constant($package).DEFAULT_HTML_DOC_PATH.$phpFile;
                
} else {
                    
//print "not $file<br />";
                    
$file $path.DEFAULT_HTML_DOC_PATH.$phpFile;
                }
                if (
file_exists($file)) {
                    
$text substr(basename(constant($package)), strlen(MYPHP_PREFIX.CURRENT_VERSION));
                    if ( 
$text == $tabSourceCode ) {
                        
$filename $file;
                        
//print "require $key $file<br />\r\n";
                        
break;
                    } else {
                        
// Ignore
                        //print "Ignore $text $key $file<br />\r\n";
                    
}
                } else {
                    
// Ok
                    // print "Not exists $key $file<br />\r\n";
                
}
            } else {
                
// Ok, not part of the packages
                // print "Not part of package $key $package<br />\r\n";
            
}
        }
        return 
$filename;
    }

    
/**
     * Get the array of index menu links
     * <code>
     * Usage:
     *    $documents = array('Message','MessageList','Redirect','Rowcolor','Singleton',);
     *    $indexMenuLinks = IndexMenu::links($documents);
     * </code>
     * @static
     * @param array $documents The array of index links
     * @return array The rows of array links for the Index.php
     */
    
public static function links($documents) {
        
$indexmenuLinks = array(); 
        
$isRequest false;
        if (
defined('TAB_SHOW') && TAB_SHOW TAB_SHOW_URL) {
            
$isRequest true;
        }
        
$params '';
        
$tabSourceCode TAB_INDEX;
        
$port Server::getServerPort();
        if (
$port != '80') {
            
$port ":$port";
        } else {
            
$port '';
        }
        
$domainNameSourceCode 'http:/'.'/'.(DOMAIN_NAME!='localhost'?DOMAIN_NAME_SOURCE_CODE:DOMAIN_NAME).$port;
        
$urlencode true;
        
$object = new Params();
        if (
$isRequest) {
            
$params $object->get(array(REQUEST_INDEX=>''), $urlencode__FILE____LINE__);
            
$indexmenuLinks[] = array('text'=>LINK_TEXT_OVERVIEW,'href'=>$domainNameSourceCode.$params,'aux'=>LINK_LAYOUT_LI,'class'=>'','title'=>LINK_TITLE_OVERVIEW,);
        } else {
            
$params $object->get(array(), $urlencode__FILE____LINE__);
            
$indexmenuLinks[] = array('text'=>LINK_TEXT_OVERVIEW,'href'=>$domainNameSourceCode.$GLOBALS[LINK_NAME_HREF ][LINK_SOURCE_CODE].'/'.$tabSourceCode.$params,'aux'=>LINK_LAYOUT_LI,'class'=>'','title'=>LINK_TITLE_OVERVIEW,);
        }
        foreach(
$documents as $document) {
            if (
$isRequest) {
                
$params $object->get(array(REQUEST_INDEX=>$document), $urlencode__FILE____LINE__);
                
$indexmenuLinks[] = array('text'=>$document,'href'=>$domainNameSourceCode.$params,'aux'=>LINK_LAYOUT_LI);
            } else {
                
$params $object->get(array(), $urlencode__FILE____LINE__);
                
$indexmenuLinks[] = array('text'=>$document,'href'=>$domainNameSourceCode.$GLOBALS[LINK_NAME_HREF ][LINK_SOURCE_CODE].'/'.$tabSourceCode.'/'.$document.$params,'aux'=>LINK_LAYOUT_LI);
            }
        }
        return 
$indexmenuLinks;
    }
    
    
/**
     * Builds the html for an Index menu, and return it 
     * @return String The Index menu as html
     */
    
function getHtml() {
        
$html '';
        
$documents = array('Message','MessageList','Redirect','Rowcolor','Singleton',);
        
$indexmenuLinks IndexMenu::links($documents);
        foreach(
$indexmenuLinks as $no=>$links) {
            
$row '';
            foreach(
$links as $key=>$value) {
                
$row .= "$key=>$value ";
            }
            
$html .= "$no$row<br />\r\n";
        }
        return 
$html;
    }
}
?>

Vis: HTML source code

IndexMenu, HTML source code

Den fulde HTML kildekode for IndexMenu klassen

<?
0
text=>Oversigt href=>http://finnrasmussen.dk/source-code/tab aux=>16 class=> title=>Klik her for at se oversigten ...  <br />
1text=>Message href=>http://finnrasmussen.dk/source-code/tab/Message aux=>16 <br />
2text=>MessageList href=>http://finnrasmussen.dk/source-code/tab/MessageList aux=>16 <br />
3text=>Redirect href=>http://finnrasmussen.dk/source-code/tab/Redirect aux=>16 <br />
4text=>Rowcolor href=>http://finnrasmussen.dk/source-code/tab/Rowcolor aux=>16 <br />
5text=>Singleton href=>http://finnrasmussen.dk/source-code/tab/Singleton aux=>16 <br />

?>

Vis: Class methods

IndexMenu, Class methods

Her er 'klasse metoderne' for IndexMenu klassen:

  • __construct
  • file
  • links
  • getHtml

Vis: Object vars

IndexMenu, Object vars

Her er 'objekt variable' for IndexMenu klassen:


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+squeeze9) 1.11
blank.gif