Created
July 14, 2011 09:44
-
-
Save k-holy/1082194 to your computer and use it in GitHub Desktop.
Phanda_PathTranslator
This file contains 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
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !__gateway\.php$ | |
RewriteRule .* __gateway.php [L] |
This file contains 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 | |
Phanda_PathTranslator::getInstance()->initialize() | |
->setParameterDirectoryName('%VAR%') | |
->setSearchExtensions('php') | |
->execute(); | |
/** | |
* /categories/1/items/2/detail.json へのリクエストの場合 | |
* /categories/%VAR%/items/%VAR% にカレントディレクトリを移動、 | |
* /categories/%VAR%/items/%VAR%/detail.php が読み込まれます。 | |
*/ |
This file contains 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 | |
$translator = Phanda_PathTranslator::getInstance(); | |
$categoryId = $translator->getParameter(0); | |
$itemId = $translator->getParameter(1); | |
$extension = $translator->getExtension(); | |
/** | |
* /categories/1/items/2/detail.json へのリクエストを処理した結果、 | |
* このファイル(/categories/%VAR%/items/%VAR%/detail.php)が | |
* 読み込まれたとすると、以下の値がセットされます。 | |
* $categoryId = '1' | |
* $itemId = '2' | |
* $extension = 'json' | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment