zend framework中調用kindeditor編輯器實現方法

來源:互聯網
上載者:User

cmd命令進入zf.bat所在的目錄,

zf.bat create project 項目的全路徑(如:d:/hspzf)

如果提示php.exe不是內部或外部命令,就要將你自己的php檔案夾目錄D:wampbinphpphp5.4.3和www目錄D:wampwwwbin(即使www目錄下沒有bin這個目錄,也加上為好)加到path路徑中去,這樣建立出來的zf項目的目錄結構是很全面的。
 
第二點:
如果想在view視圖中引入js或者css樣式,可以通過如下命令:

 代碼如下 複製代碼
<?php echo $this->headLink()->appendStylesheet($this->baseUrl().'/public/styles/layout.css'); ?>
<?php echo $this->headScript()->appendFile($this->baseUrl().'/public/kindeditor/kindeditor-min.js')
                              ->appendFile($this->baseUrl().'/public/kindeditor/lang/zh_CN.js')
                              ->appendFile($this->baseUrl().'/public/scripts/editor.js');
?>

headLink方法是引入css,headScript方法是引入js檔案,jquery檔案也可以這樣引入;

引入這些之前要將.htaccess檔案寫好:

 代碼如下 複製代碼

# Zend Framework rewrite規則
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
# 安全性考慮:不允許清單目錄內容
Options -Indexes
# PHP設定
php_flag magic_quotes_gpc off
php_flag register_globals off

 

其中很重要的是

 代碼如下 複製代碼

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php

這兩句話一定不能顛倒,RewriteRule .* index.php必須放在下面,

我從昨天晚上研究引入上面代碼中kindeditor編輯器的js檔案,就因為上下位置不一樣,害的我好苦。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.