萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> php編程 >> fck調用與使用方法

fck調用與使用方法

fck調用與使用方法


function load($areaname){
   $this->initialize($areaname);
   return $this->loadhtml() ;
  }

  function loadhtml(){
   $htmlareavalue = htmlspecialchars($this->areavalue) ;
   $html = '<div>' ;
   if ($this->browsers()){
    if (isset($_GET['fcksource']) && $_GET['fcksource'] == "true"){
     $File = 'fckeditor.original.html' ;
    }else{
     $File = 'fckeditor.html' ;
    }
    $Link = "{$this->rooteditor}editor/{$File}?InstanceName={$this->areaname}";
    if ($this->bottontype != ''){
     $Link .= "&amp;Toolbar={$this->bottontype}";
    }
    $html .= "<input type="hidden" id="{$this->areaname}" name="{$this->areaname}" value="{$htmlareavalue}" style="display:none" />";// Render the linked hidden field.
    $html .= "<input type="hidden" id="{$this->areaname}___configure" value="" . $this->loadconfigure() . "" style="display:none" />";// Render the configurations hidden field.
    $html .= "<iframe id="{$this->areaname}___Frame" src="{$Link}" width="{$this->areawidth}" height="{$this->areaheight}" frameborder="0" scrolling="no"></iframe>";// Render the editor IFRAME.
   }else{
    if (strpos($this->areawidth,'%') === false){
     $areawidthCSS = $this->areawidth . 'px' ;
    }else{
     $areawidthCSS = $this->areawidth;
    }
    if ( strpos( $this->areaheight, '%' ) === false){
     $areaheightCSS = $this->areaheight . 'px' ;
    }else{
     $areaheightCSS = $this->areaheight ;
    }
    $html .= "<textarea name="{$this->areaname}" rows="4" cols="40" style="width: {$areawidthCSS}; height: {$areaheightCSS}">{$htmlareavalue}</textarea>" ;
   }
   $html .= '</div>' ;
   return $html ;
  }

function initialize($areaname){
   global $urlconf;
   $this->areaname   = $areaname ;
   $this->rooteditor  = $urlconf['domains'].'textarea/fck/' ;
   $this->areawidth  = '100%';
   $this->areaheight  = '400px';
   $this->bottontype  = 'Default';
   $this->areavalue  = $this->areavalue ? $this->areavalue : '';
   $this->configure  = array() ;
  }

  function dater($data){
   $this->areavalue = stripslashes($data);
  }

copyright © 萬盛學電腦網 all rights reserved