CBaseUrlRule を拡張してサイト上のある種のページを管理する独自のクラスを作成しました。結果クラスコードは
class HotelUrlRule extends CBaseUrlRule {
public function parseUrl($manager,$request,$pathInfo,$rawPathInfo) {
if(isset($_GET['id'])) {
if (($_GET['id'] != 0) && ($pathInfo == 'hotel')) {
return 'hotel/index';
}
}
return false;
}
public function createUrl($manager,$route,$params,$ampersand) {
if ($route == 'hotel/index') {
Yii::import('application.controllers.SearchController');
$searcher = new SearchController($this, NULL);
$hotelRaw = $searcher->actionGetHotelInformation($_GET['id']);
$hotelRaw = $hotelRaw['GetHotelInformationResult'];
$hotelName = $hotelRaw['Name'];
$hotelName = preg_replace('%(\s)%', '-', $hotelName);
return 'hotel/' . $hotelName;
}
return false;
}
}
parseUrl ($_GET['id'] != 0) && ($pathInfo == 'hotel') の条件は「true」を返し、createUrl ($route == 'hotel/index') の条件は「false」を返します. $route の Var_dump は「admin/auth」です。
なぜそうなのですか?推測はありますか?