Created
July 16, 2011 07:49
-
-
Save hiromi2424/1086113 to your computer and use it in GitHub Desktop.
SlugRoute example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$defautlOptions = array( | |
'model' => null, // Inflector::classify($controller) by default | |
'display' => ':displayField', // ルートのスラグに適応されるフィールド。モデルのdisplayFieldがデフォルト | |
'lookup' => ':primaryKey', // コントローラのアクション引数、URLの指定のpass($id)に渡すべきフィールド。モデルのプライマリーキーがデフォルト。 | |
'cacheConfig' => 'default', // 使用するキャッシュのコンフィグ名。falseを指定するとキャッシュしない。 | |
'recursive' => -1, // モデルのクエリでのrecursiveの値 | |
'named' => ':displayField', // スラグのパラメータ名。/post/:title のtitleに当たるもの。 | |
'identity' => ':name', // インスタンスの名前。デフォルトはモデル名。キャッシュの操作に使う | |
'urlencode' => true, // urlencodeを行うかどうか。マルチバイト文字が含まれる場合は基本必須。 | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (App::import('Ninja.route' . DS . 'AutoSlugRoute')) { | |
Router::conenct( | |
'post/:title', | |
array( | |
'controller' => 'posts', | |
'action' => 'view', | |
), | |
array( | |
'routeClass' => 'AutoSlugRoute', | |
) | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$defaultOptions = array( | |
'model' => null, // Inflector::classify($controller) by default | |
'cacheConfig' => 'default', // 使用するキャッシュのコンフィグ名。falseを指定するとキャッシュしない。 | |
'identity' => ':alias', // インスタンスの名前。デフォルトはモデル名。キャッシュの操作に使う | |
'urlencode' => true, // urlencodeを行うかどうか。マルチバイト文字が含まれる場合は基本必須。 | |
'conditions' => array(), // モデルのクエリに渡す条件 | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (App::import('Ninja.route' . DS . 'MultiSlugRoute')) { | |
Router::conenct( | |
'post/:title', | |
array( | |
'controller' => 'posts', | |
'action' => 'view', | |
), | |
array( | |
'routeClass' => 'MultiSlugRoute', | |
'slugs' => array( | |
'title', | |
), | |
) | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (App::import('Ninja.route' . DS . 'MultiSlugRoute')) { | |
Router::conenct( | |
'post/:name/:title', | |
array( | |
'controller' => 'posts', | |
'action' => 'view', | |
), | |
array( | |
'routeClass' => 'MultiSlugRoute', | |
'slugs' => array( | |
'name' => array( | |
'model' => 'User', | |
), | |
'title', | |
), | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment