Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Base  /  Cssimage   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

CssImage.php


Vis: Sample code, tutorial

CssImage, Sample code, tutorial

Sådan benyttes komponenten CssImage klassen

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

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

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

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

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

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

Skjul: Sådan vises komponenten

CssImage, Sådan vises komponenten

Sådan vises komponenten CssImage klassen


Vis: PHP source code

CssImage, PHP source code

Den fulde PHP kildekode for CssImage klassen

<?php
/**
 * @package base
 * @see HTML_BASE_PAGE_PATH.'/CssImage.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_PAGE_PATH.'/Css.php');
require_once(
HTML_BASE_UTIL_PATH.'/Style.php');
require_once(
HTML_BASE_UTIL_PATH.'/Images.php');

/**
 * The CSS for the Base package
 * Generates the Base CSS
 * <code> 
 * Usage:
 *   $tag      = CSS_NAME_BODY;
 *   $url      = '/images/background.gif';
 *   $repeat   = CSS_REPEAT_NO;
 *   $position = CSS_POSITION_TOP.' '.CSS_POSITION_RIGHT;
 *   $css = new CssImage($tag, $url, $repeat, $position);
 *   print $css->getHtml();
 * Or:
 *   CssImage::display($tag, $url, $repeat, $position);
 * </code>
 * @package base 
 */

class CssImage extends Style {
    
/**
     * @var String $tag The tag to use for the background image
     */
    
protected $tag '';
    
/**
     * @var String $url The url for the background image
     */
    
protected $url '';
    
/**
     * @var String $repeat The repeat directive for the background image
     */
    
protected $repeat '';
    
/**
     * @var String $position The position for the background image
     */
    
protected $position '';
    
    
/**
     * Constructor
     * @param  String $tag      The tag to use for the background image
     * @param  String $url      The url for the background image
     * @param  String $repeat   The repeat directive for the background image
     * @param  String $position The position for the background image
     */
    
function __construct($tag=''$url=''$repeat=''$position='') {
        
parent::__construct();
        
$image          = new Images(IMAGE_BACKGROUND); 
        
$this->tag      $tag      != '' $tag      CSS_NAME_BODY
        
$this->url      $url      != '' $url      $image->getSrcName(); 
        
$this->repeat   $repeat   != '' $repeat   CSS_REPEAT_NO
        
$this->position $position != '' $position CSS_POSITION_TOP.' '.CSS_POSITION_RIGHT
    }
    
    
/**
     * Returns the new Content as an object
     * @return Object the complete css
     */
    
function newCss() {
        
$object  = new Raw();
        
// Body Background Image
        
if (defined('IMAGE_BACKGROUND')) {
            
$image = new Images(IMAGE_BACKGROUND); 
            
$css   = new Css($this->getClassName());
            if (
defined('DEBUG_LEVEL_SHOW_INFO') && DEBUG_LEVEL DEBUG_LEVEL_SHOW_INFO) {
                
$object->add(new Raw($css->getHeader("Auto created")));
            }
            
$object->add(new Raw($css->getImage($this->tag$this->url$this->repeat$this->position)));
        }
        return 
$object;
    }

    
/**
     * Returns the html for the css file
     * @return String the complete html
     */
    
function getHtml() {
        
$html  $this->html;
        
$this->add($this->newCss());
        
$html .= $this->getStart();
        
$html .= $this->getCss();
        
$html .= $this->getEnd();
        return 
$html;
    }
    
    
/**
     * Display html
     * <code>
     * Usage:
     *   $tag      = CSS_NAME_BODY;
     *   $url      = '/images/background.gif';
     *   $repeat   = CSS_REPEAT_NO;
     *   $position = CSS_POSITION_TOP.' '.CSS_POSITION_RIGHT;
     *   CssImage::display($tag, $url, $repeat, $position);
     * </code> 
     * @static
     * @param  String $tag      The tag to use for the background image
     * @param  String $url      The url for the background image
     * @param  String $repeat   The repeat directive for the background image
     * @param  String $position The position for the background image
     */
    
public static function display($tag=''$url=''$repeat=''$position='') {
        
$html = new CssImage($tag$url$repeat$position);
        
$html->addHtml();
    }
}
?>

Vis: HTML source code

CssImage, HTML source code

Den fulde HTML kildekode for CssImage klassen

<?
<!-- DEBUGCssImage -->
<
style type="text/css">
    
/***********************************************************
     *
     * AUTOGENERATED file, DO NOT CHANGE OR EDIT, the full source code is here
           _____________________________________________________
  ________|                                                     |________
  \       |   http://Finn-Rasmussen.com Phone (+45) 40 50 60 69 |       /
   \      |   Kongens Vænge 79, 3400 Hillerød, Denmark          |      /
   /      |_____________________________________________________|      \
  /___________)                                              (__________\

     *
     * @version       : 1.11
     * @since         : 12-Aug-2011 13:48:13
     * @copyright     : Copyright © 1999-2010 http://Finn-Rasmussen.com
     *
     * Email          : Please, phone me for my email address
     * Web            : http://Finn-Rasmussen.com
     *                : This website was created by the myPHP taglib and CMS
     *                : Download a free demo of the myPHP taglib here ...
     *                : http://Finn-Rasmussen.com/myPHP/
     * @domain        : expert-guide.com
     * @language      : da
     * @webmaster     : DEFAULT_CMS_LOGIN_USERNAME(+)expert-guide.com
     * @file          : /cache/files/expert-guide.com-CssImage (Autocreated cache file)
     * @classname     : Auto created
     ***********************************************************/

body{
    
background-image    url('/myphp-1.11/myphp-1.11-netbank.eksperter.dk/html/images/waves.jpg');
    
background-repeat    no-repeat;
    
background-position    top right;
}


    
/***********************************************************
     *
     * AUTOGENERATED file, DO NOT CHANGE OR EDIT, the full source code is here
           _____________________________________________________
  ________|                                                     |________
  \       |   http://Finn-Rasmussen.com Phone (+45) 40 50 60 69 |       /
   \      |   Kongens Vænge 79, 3400 Hillerød, Denmark          |      /
   /      |_____________________________________________________|      \
  /___________)                                              (__________\

     *
     * @version       : 1.11
     * @since         : 12-Aug-2011 13:48:13
     * @copyright     : Copyright © 1999-2010 http://Finn-Rasmussen.com
     *
     * Email          : Please, phone me for my email address
     * Web            : http://Finn-Rasmussen.com
     *                : This website was created by the myPHP taglib and CMS
     *                : Download a free demo of the myPHP taglib here ...
     *                : http://Finn-Rasmussen.com/myPHP/
     * @domain        : expert-guide.com
     * @language      : da
     * @webmaster     : DEFAULT_CMS_LOGIN_USERNAME(+)expert-guide.com
     * @file          : /cache/files/expert-guide.com-CssImage (Autocreated cache file)
     * @classname     : Auto created
     ***********************************************************/

body{
    
background-image    url('/myphp-1.11/myphp-1.11-netbank.eksperter.dk/html/images/waves.jpg');
    
background-repeat    no-repeat;
    
background-position    top right;
}


</
style>

?>

Vis: Class methods

CssImage, Class methods

Her er 'klasse metoderne' for CssImage klassen:

  • __construct
  • newCss
  • getHtml
  • display
  • getStart
  • getCss
  • getEnd
  • start
  • end
  • 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

CssImage, Object vars

Her er 'objekt variable' for CssImage 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.3.3-7+squeeze3) 1.11
blank.gif