1. 取得網站根目錄 ( 例如:/seminar2014 )

<?php echo Yii::app()->request->baseUrl; ?>

2. 取得網站目前網址 ( 例如:/seminar2014/site/index )

<?php echo Yii::app()->request->requestUri; ?>

3. 取得 Controller Name ( 例如:site)

ChouAndy 發表在 痞客邦 留言(0) 人氣()

git rm -r --cached .

ChouAndy 發表在 痞客邦 留言(0) 人氣()

  • 用文字編輯器打開 .git/config ,找到 ignorecase = true ,然後把 true 改成 false 就可以了,如果沒有找到這行,就自己在 core 那個區塊裡加一行 ignorecase = false 也可以達到一樣的效果。
  • 進到要修改的資料夾,在 terminal 輸入 git config core.ignorecase false ,可以讓目前的 git repository case sensitive。

ChouAndy 發表在 痞客邦 留言(0) 人氣()

  • raw: the attribute value will not be changed at all.

  • text: the attribute value will be HTML-encoded when rendering.

  • ntext: the formatNtext method will be called to format the attribute value as a HTML-encoded plain text with newlines converted as the HTML <br /> tags.

  • html: the attribute value will be purified and then returned.

  • date: the formatDate method will be called to format the attribute value as a date.

ChouAndy 發表在 痞客邦 留言(0) 人氣()

想要在一開始搜尋資料的時候,就載入關聯的資料表資料,可以使用下面方法:

1. 確認好 Model 裡的 relations()

public function relations(){
return array(
'creator' => array(self::BELONGS_TO, 'User', 'creator_id'),

ChouAndy 發表在 痞客邦 留言(0) 人氣()

記得 MySQL 預設是不支援 Foreign Key 的功能,但其實 MySQL 中有相關的套件了,只是沒有開啟而已,InnoDB 是 MySQL 上第一個提供外鍵約束的表引擎。

如何啟動:請在 my.ini 中將 skip-innodb 這行用 # 號註解掉。

引用範例:

CREATE TABLE parent(
id INT NOT NULL,

ChouAndy 發表在 痞客邦 留言(0) 人氣()

例如: Module 名稱為 admin,只要在 AdminModule.php 內,新增以下程式碼即可:

public $layout = '/layouts/column2';

至於在 column2 內 載入 main.php 只要使用 /layouts/main 即可。

ChouAndy 發表在 痞客邦 留言(0) 人氣()

1. 修改 protected\config\main.php

return array(
...
'language' => 'zh_tw',
...

ChouAndy 發表在 痞客邦 留言(0) 人氣()

手動安裝

1. 下載檔案 yii-fancybox

2. 將目錄 assets 及檔案 FancyBox.php 放到目錄 protected/extensions/fancybox 底下

3. 將底下程式碼放到 views 中

$this->widget('application.extensions.fancybox.FancyBox', array(

ChouAndy 發表在 痞客邦 留言(0) 人氣()

1. 安裝 Package Control 。

2. 使用 Package Control 搜尋 LESS

3. 安裝 LESS-sublime

4. 大功告成。

ChouAndy 發表在 痞客邦 留言(0) 人氣()


1. 前往 ChouAndy ApacheTheme 下載檔案。

2. 解壓縮之後,將 theme 資料夾 及 .htaccess 檔案放至 Apache Server Root

3. 大功告成。

ChouAndy 發表在 痞客邦 留言(0) 人氣()

為避免訪客瀏覽非預設可瀏覽的檔案及資料夾內容,可使用 .htaccess 設定禁止瀏覽的檔案及資料夾 ( 資料夾內檔案仍可存取 )。

設定範例內容如下:

RewriteEngine on
# forbidden files
RewriteCond %{REQUEST_FILENAME} -f

ChouAndy 發表在 痞客邦 留言(0) 人氣()

1 2 3
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。