Yii-kindediter-模板編輯,插入預定義變數_PHP教程

來源:互聯網
上載者:User
1.修改YIi擴充目錄下的Kdeditor.php 檔案,把中的js對象聲明放到方法外面[html] $js=<<id; KindEditor.ready(function(K) { editor_$this->id = K.create('#$this->id', $properties_string ); }); F; 2.視圖檔案代碼[html]
  • 模板變數: $val){?>
  • [html] 3.模型檔案,後期處理[html] /** * 擷取模板變數 */ public function getVarUbb($type=null){ if($type==null){ return array( '{username}'=>'{username}', '{url}'=>'{url}', '{sitename}'=>'{sitename}', ); } } /** * 模板變數替換 */ public function replaceVarUbb($str){ $str = str_replace('{username}','',$str); $str = str_replace('{url}','',$str); $str = str_replace('{sitename}','name; ?>',$str); return $str; } /** * 模板儲存後的操作 * 寫入模板檔案 */ protected function afterSave(){ $templatePath = Yii::app()->mailer->pathViews; $templatePath = str_replace('application','',$templatePath); $templatePath = str_replace('.','/',$templatePath); $templatePath = Yii::app()->basePath.$templatePath.'/'; $templatePath = $templatePath.$this->zee_filename.'.php'; $handle = fopen($templatePath, "wb"); fwrite($handle, $this->replaceVarUbb($this->zee_content)); fclose($handle); } 4.

    http://www.bkjia.com/PHPjc/477650.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477650.htmlTechArticle1.修改YIi擴充目錄下的Kdeditor.php 檔案,把中的js對象聲明放到方法外面 [html] $js=EOF var editor_$this-id; KindEditor.ready(function(K) { editor_$this-id = K.c...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.