Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du är här: /  Försida  /  Kildekoden  /  Base  /  Shortcuticon   Starta upp nu   Starta upp
blank.gif
««« Se source code
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  
Tilbaka

Gör mindra: Namn

ShortcutIcon.php


Visa: Sample code, tutorial

ShortcutIcon, Sample code, tutorial

Sådan användas ShortcutIcon klass

Först skall du inkludera den fil där beskrivar komponenten, som en klass fil

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

härefter kan du antingen bruka komponenten som ett taglib (statiske metoder):

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

eller du kan göra en instance av komponenten och bruka metoden direkte:

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

Gör mindra: Sådan visas komponenten

ShortcutIcon, Sådan visas komponenten

Sådan visas komponenten ShortcutIcon klass


Visa: PHP source code

ShortcutIcon, PHP source code

Den hela PHP kildekode för ShortcutIcon klass

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

Visa: HTML source code

ShortcutIcon, HTML source code

Den hela HTML kildekode för ShortcutIcon klass

<?
<link rel="icon" type="image/ico" href="http://finnrasmussen.dk/myphp-1.11/myphp-1.11-finnrasmussen.dk/html/images/favicon.ico" />

?>

Visa: Class methods

ShortcutIcon, Class methods

Här är 'klasse metoden' för ShortcutIcon klass:

  • __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

Visa: Object vars

ShortcutIcon, Object vars

Här är 'objekt variable' för ShortcutIcon klass:

  • html =>
  • sql =>

MenuRight 
triangle.gif

Dansk

Deutch

English (UK)

France

Italy

Norsk

Svensk

English (USA)


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