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


Sample code, tutorial

Sådan benyttes komponenten EmailLink klassen

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

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

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

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

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

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

Parent html

Sådan vises komponenten EmailLink klassen

Report spam

PHP source code

Den fulde PHP kildekode for EmailLink klassen

<?
/**
* @package base
* @see HTML_BASE_UTIL_PATH.'/EmailLink.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');
require_once(
HTML_BASE_UTIL_PATH.'/Link.php');

/**
* Returns a complete Email Link as HTML
* The link may be terminated by a <br /> or surronded by <li> tags
* as specified by the $aux parameter
*
* <code>
*    <a class="$class" href="mailto:$href" title="$title">$text</a>
* Usage:
*   $link = new Link($text,$href,$class,$title,$aux);
*   print $link->getHtml();
* Or
*   EmailLink::display($text,$href,$class,$title,$aux);
* </code>
* @package base
*/

class EmailLink extends Link {
   
/**
    * Constructor
    * @param String $text  The text for the link
    * @param String $href  The url for the link
    * @param String $class The class of the link
    * @param String $title The tool tip of the link
    * @param String $aux   Add 'br' or 'li' html tags, if required
    */
    
function EmailLink($text,$href,$class='',$title='',$aux='') {
        
$mailto = 'mailto:';
        
$strHttp  = 'http:/'.'/';
        
$strHttps = 'https:/'.'/';
        if (
strpos($href,$strHttp) !==false || strpos($href,$strHttps)!==false) {
            
$mailto = '';
        }
        
$this->Link($text,$mailto.$href,$class,$title,$aux);
    }

   
/**
    * Display an email link
    * <code>
    * Usage:
    *    EmailLink::display($text,$href,$class,$title,$aux);
    * </code>
    * @static
    * @param String $text  The text for the link
    * @param String $href  The url for the link
    * @param String $class The css class of the link
    * @param String $title The tool tip of the link
    * @param String $aux   Add 'br' or 'li' html tags, if required
    */
    
function display($text,$href,$class='',$title='',$aux='') {
        
$html = new EmailLink($text,$href,$class,$title,$aux);
        
$html->addHtml();
    }
}
?>

HTML source code

Den fulde HTML kildekode for EmailLink klassen

<?
<!-- Report spam --><a id="Emaillink60" class="baseLinkColor" href="mailto:int@spamklage.dk" title="Report spam">Report&nbsp;spam</a>
?>

Class methods

Her er 'klasse metoderne' for EmailLink klassen:

  • link
  • getparams
  • gethtml
  • display
  • object
  • getclassname
  • getmsg
  • addhtml
  • tostring
  • getcachefilename
  • save
  • content
  • html
  • setobject
  • set
  • get
  • getattribute
  • gettag
  • add
  • getsizeof
  • getelement
  • getelements
  • gettoogle
  • getmaximize
  • getminimize
  • newtriangle
  • showsource
  • element
  • getvalue
  • setid
  • setonfocus
  • setonblur
  • id
  • emaillink

Object vars

Her er 'objekt variable' for EmailLink klassen:

  • text => Report spam
  • href => mailto:int@spamklage.dk
  • aux =>
  • target =>
  • html =>
  • sql =>
  • elements => Array
  • sizeof => 0
  • name =>
  • id => Emaillink60
  • value =>
  • class => baseLinkColor
  • title => Report spam
  • tabindex =>
  • onclick =>
  • accesskey =>
  • onfocus =>
  • onblur =>

  triangle.gif

danmark

Germany

England

France

Italy

Norge

Sverige

USA