1. 取得網站根目錄 ( 例如:/seminar2014 )
<?php echo Yii::app()->request->baseUrl; ?>
2. 取得網站目前網址 ( 例如:/seminar2014/site/index )
<?php echo Yii::app()->request->requestUri; ?>
ChouAndy 發表在 痞客邦 留言(0) 人氣(292)
ChouAndy 發表在 痞客邦 留言(0) 人氣(23)
用文字編輯器打開 .git/config ,找到 ignorecase = true ,然後把 true 改成 false 就可以了,如果沒有找到這行,就自己在 core 那個區塊裡加一行 ignorecase = false 也可以達到一樣的效果。
進到要修改的資料夾,在 terminal 輸入 git config core.ignorecase false ,可以讓目前的 git repository case sensitive。
ChouAndy 發表在 痞客邦 留言(0) 人氣(20)
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.
time: the formatTime method will be called to format the attribute value as a time.
datetime: the formatDatetime method will be called to format the attribute value as a date with time.
boolean: the formatBoolean method will be called to format the attribute value as a boolean display.
number: the formatNumber method will be called to format the attribute value as a number display.
email: the formatEmail method will be called to format the attribute value as a mailto link.
image: the formatImage method will be called to format the attribute value as an image tag where the attribute value is the image URL.
url: the formatUrl method will be called to format the attribute value as a hyperlink where the attribute value is the URL.
ChouAndy 發表在 痞客邦 留言(0) 人氣(13)
想要在一開始搜尋資料的時候,就載入關聯的資料表資料,可以使用下面方法:
1. 確認好 Model 裡的 relations()
public function relations(){
return array(
'creator' => array(self::BELONGS_TO, 'User', 'creator_id'),
);
}
ChouAndy 發表在 痞客邦 留言(0) 人氣(71)
記得 MySQL 預設是不支援 Foreign Key 的功能,但其實 MySQL 中有相關的套件了,只是沒有開啟而已,InnoDB 是 MySQL 上第一個提供外鍵約束的表引擎。
如何啟動:請在 my.ini 中將 skip-innodb 這行用 # 號註解掉。
引用範例:
CREATE TABLE parent(
id INT NOT NULL,
PRIMARY KEY (id)
) ENGINE = INNODB;
CREATE TABLE child(
id INT,
parent_id INT,
INDEX par_ind (parent_id),
FOREIGN KEY(parent_id) REFERENCES parent(id) ON DELETE CASCADE
) ENGINE = INNODB;
-- 參數:
[ON DELETE {CASCADE | SET NULL | NO ACTION | RESTRICT}]
[ON UPDATE {CASCADE | SET NULL | NO ACTION | RESTRICT}]
ChouAndy 發表在 痞客邦 留言(0) 人氣(787)
例如: Module 名稱為 admin,只要在 AdminModule.php 內,新增以下程式碼即可:
public $layout = '/layouts/column2';
至於在 column2 內 載入 main.php 只要使用 /layouts/main 即可。
ChouAndy 發表在 痞客邦 留言(0) 人氣(46)
1. 修改 protected\config\main.php
return array(
...
'language' => 'zh_tw',
...
);
ChouAndy 發表在 痞客邦 留言(0) 人氣(133)
手動安裝
1. 下載檔案 yii-fancybox
2. 將目錄 assets 及檔案 FancyBox.php 放到目錄 protected/extensions/fancybox 底下
ChouAndy 發表在 痞客邦 留言(0) 人氣(81)
1. 安裝 Package Control 。
2. 使用 Package Control 搜尋 LESS。
ChouAndy 發表在 痞客邦 留言(0) 人氣(108)