««« Se kilde koden
triangle.gif Basic Base  Component Db Dto Form Form-elements Jquery Layout Menu Menu-fisheye Mvc Tab Table Template Util
 
arrow-headline.gif Index
 
 Tilbage

Navn : ShortcutIcon.php


Sample code, tutorial

Sådan benyttes komponenten ShortcutIcon klassen

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

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

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

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

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

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

Parent html

Sådan vises komponenten ShortcutIcon klassen


PHP source code

Den fulde PHP kildekode for ShortcutIcon klassen

<?
/**
* @package base
* @see HTML_BASE_PAGE_PATH.'/ShortcutIcon.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_COMMON_PATH.'/Html.php');
if (
defined('HTML_UTIL_COMPONENT_PATH')) {
    require_once(
HTML_UTIL_COMPONENT_PATH.'/Url.php');
}

/**
* The ShortcutIcon.
* Generates the Shortcut Icon (FavIcon)
* For the web browser favorite icon<br>
* Generates the following html
* <link rel="SHORTCUT ICON" href="'.$href.'" />;
*
* <code>
* Usage:
*   $favicon = new ShortcutIcon($href);
*   print $favicon->getHtml();
* Or:
*   ShortcutIcon::display($href);
* </code>
* @package base
*/

class ShortcutIcon extends Html {
    
/**
     * @access private
     * @var String $href The href for the shortcut icon
     */
    
var $href = '';

    
/**
     * Constructor
     * @param String $href The url and filename to the Shortcut Icon
     */
    
function ShortcutIcon($href='') {
        
$this->Html();
        
$domainname = '';
        if (
defined('HTML_UTIL_COMPONENT_PATH')) {
            
$domainname = Url::subdomain(DOMAIN_NAME); // Strip off subdomain names
        
}
        
$this->href = $href!=''?$href:$domainname.SHORT_CUT_ICON_PATH.'/'.SHORT_CUT_ICON_FILE_NAME;
    }

    
/**
     * Returns the html for the Shortcut Icon (favicon)
     * @return String the complete html
     */
    
function getHtml() {
        
$html  = '';
        
$html .= '<link rel="SHORTCUT ICON" href="'.$this->href.'" />'."\r\n";
        return
$html;
    }

    
/**
     * Display html
     *
     * <code>
     * Usage:
     *    ShortcutIcon::display($href);
     * </code>
     *
     * @static
     * @param String $href The url to the Shortcut Icon
     */
    
function display($href='') {
        
$html = new ShortcutIcon($href);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for ShortcutIcon klassen

<?
<link rel="SHORTCUT ICON" href="/favicon.ico" />

?>

Class methods

Her er 'klasse metoderne' for ShortcutIcon 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
  • shortcuticon

Object vars

Her er 'objekt variable' for ShortcutIcon klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 0
  • href => /favicon.ico

  triangle.gif

danmark

Germany

England

France

Italy

Norge

Sverige

USA