««« 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 : Noscript.php


Sample code, tutorial

Sådan benyttes komponenten Noscript klassen

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

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

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

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

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

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

Parent html

Sådan vises komponenten Noscript klassen


PHP source code

Den fulde PHP kildekode for Noscript klassen

<?
/**
* @package base
* @see HTML_BASE_PAGE_PATH.'/Noscript.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');

/**
* Generates the html for the noscript tag
* <code>
* Usage:
*   $noscript = new Noscript();
*   print $noscript->getHtml();
* Or
*   Noscript::display();
* </code>
* @package base
*/

class Noscript extends Html {
    
/**
     * @var String $text The text to show for the noscript tag
     */
    
var $text = '';

    
/**
     * Constructor
     * @param String $text The text for the noscript tag
     */
    
function Noscript($text='') {
        
$this->Html();
        
$this->text = $text!=''?$text:NO_SCRIPT_TEXT;
    }

    
/**
     * Returns the html for the css file
     * @return String the complete html
     */
    
function getHtml() {
        
$html  = '';
        switch (
HTTP_USER_AGENT) {
            case
HTTP_USER_AGENT_P900:
                
// Ignore SonyEricssonP900
                
break;
            default:
                
$html .= '<noscript><h1>'.$this->text.'</h1></noscript>'."\r\n";
                break;
        }
        return
$html;
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Noscript::display($text);
     * </code>
     * @static
     * @param String $text The text for the no script tag
     */
    
function display($text='') {
        
$html = new Noscript($text);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for Noscript klassen

<?
<noscript><h1>Desværre har du ikke slået javascript til i din browser,<br />så dele af hjemmesiden vil ikke fungere</h1></noscript>

?>

Class methods

Her er 'klasse metoderne' for Noscript 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
  • noscript

Object vars

Her er 'objekt variable' for Noscript klassen:

  • html =>
  • sql =>
  • elements => Array
  • sizeof => 0
  • text => Desværre har du ikke slået javascript til i din browser,
    så dele af hjemmesiden vil ikke fungere

  triangle.gif

danmark

Germany

England

France

Italy

Norge

Sverige

USA