Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Base  /  Shortcuticon   Login nu   Login
blank.gif
««« Se kilde koden
blank.gif
tls.gif     Base  trs.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 tl.gif Tab tr.gif tl.gif Table tr.gif tl.gif Util tr.gif
blank.gif
blank.gif
arrow-headline.gif Index
MenuLink  MenuLeft  
Tilbage

Skjul: Navn

ShortcutIcon.php


Vis: Sample code, tutorial

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

Skjul: Sådan vises komponenten

ShortcutIcon, Sådan vises komponenten

Sådan vises komponenten ShortcutIcon klassen


Vis: PHP source code

ShortcutIcon, PHP source code

Den fulde PHP kildekode for ShortcutIcon klassen

<?php
/**
 * @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.11
 * @since 27-nov-2009
 */

/**
 * The required files
 */
require_once(HTML_BASE_COMMON_PATH.'/Html.php');
require_once(
HTML_BASE_UTIL_PATH.'/Images.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 type="image/png" rel="icon" 
 *       href="http://finn-rasmussen.com/favicon.png" />;
 *
 * <code>
 * Usage:
 *   $href = "http://finn-rasmussen.com/favicon.png";
 *   $type = IMAGE_SUFFIX_PNG;
 *   $favicon = new ShortcutIcon($href, $type);
 *   print $favicon->getHtml();
 * Or:
 *   ShortcutIcon::display($href, $type);
 * </code>
 * @package base
 */

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

    
/**
     * @access private
     * @var String $type The type of image
     */
    
protected $type ''

    
/**
     * Constructor
     * @param String $href The url and filename to the Shortcut Icon
     * @param String $type The image suffix like i.e. ico / png
     */
    
function __construct($href=''$type='') {
        
parent::__construct();
        
$this->type $type !== '' $type IMAGE_SUFFIX_ICO;
        if (
$href != '') {
            
$this->href $href;
        } else {
            
$name   IMAGE_FAVICON;
            
$width  "";
            
$height "";
            
$alt    "";
            
$class  "";
            
$border "";
            
$aux    "";
            
$suffix $this->type;
            
$shortcutIcon = new Images($name$width$height$alt$class$border$aux$suffix);
            
$this->href $shortcutIcon->getSrcName();
        }
    }

    
/**
     * Returns the html for the Shortcut Icon (favicon)
     * @return String the complete html
     */
    
function getHtml() {
        
$html  ''// TODO use Link class
        
$html .= '<link rel="icon" type="image/'.$this->type.'" href="'.$this->href.'" />'."\r\n";
        return 
$html;
    }

    
/**
     * Display html
     *
     * <code>
     * Usage:
     *    $href = "http://finn-rasmussen.com/favicon.png";
     *    $type = IMAGE_SUFFIX_PNG;
     *    ShortcutIcon::display($href, $type);
     * </code>
     * 
     * @static
     * @param String $href The url to the Shortcut Icon
     * @param String $type The image suffix. I.e. ico, png
     */
    
public static function display($href=''$type='') {
        
$html = new ShortcutIcon($href$type);
        
$html->addHtml();
    }
}
?>

Vis: HTML source code

ShortcutIcon, HTML source code

Den fulde HTML kildekode for ShortcutIcon klassen

<?
<link rel="icon" type="image/ico" href="http://skadedyr.info/images/favicon.ico" />

?>

Vis: Class methods

ShortcutIcon, Class methods

Her er 'klasse metoderne' for ShortcutIcon klassen:

  • __construct
  • getHtml
  • display
  • 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

ShortcutIcon, Object vars

Her er 'objekt variable' for ShortcutIcon 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.2.6-1+lenny9) 1.11
blank.gif