本文整理汇总了PHP中AkrecipesFrontendHelper::getItemAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP AkrecipesFrontendHelper::getItemAlias方法的具体用法?PHP AkrecipesFrontendHelper::getItemAlias怎么用?PHP AkrecipesFrontendHelper::getItemAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AkrecipesFrontendHelper
的用法示例。
在下文中一共展示了AkrecipesFrontendHelper::getItemAlias方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
//.........这里部分代码省略.........
$app = JFactory::getApplication();
$id = $app->input->getInt('id');
}
// empty id , no SEF to be done. just return
if (empty($id) or is_null($id)) {
return $segments;
}
switch ($view) {
case 'recipes':
// category view
$categories = JCategories::getInstance('Akrecipes');
$category = $categories->get($id);
if (is_null($category)) {
return $segments;
}
$catPath = $category->getPath();
if (is_array($catPath)) {
foreach ($catPath as $key => $value) {
list($id, $path) = explode(':', $value, 2);
$segments[] = $path;
}
}
unset($query['task']);
unset($query['layout']);
break;
case 'recipe':
// $model = AkrecipesFrontendHelper::getModel($view);
// if ( $model !== null) {
// $item = $model->getData($id);
// $alias = $model->getAliasFieldNameByView($view);
// $segments[] = $item->$alias;
// unset($query['task']);
// unset($query['catid']) ;
// }
if ($id) {
$alias = AkrecipesFrontendHelper::getItemAlias($id);
$segments[] = $alias;
unset($query['task']);
unset($query['catid']);
}
break;
case 'recipesbyuser':
$user = JFactory::getUser($id);
$segments[] = 'author';
$segments[] = str_replace(' ', '-', strtolower($user->name));
unset($query['task']);
unset($query['layout']);
break;
case 'contests':
$segments[] = 'contests';
unset($query['task']);
unset($query['layout']);
unset($query['Itemid']);
break;
case 'contest':
$segments[] = 'contests';
// $model = AkrecipesFrontendHelper::getModel($view);
// if ( $model !== null) {
// $item = $model->getData($id);
// $alias = $model->getAliasFieldNameByView($view);
// $segments[] = $item->$alias;
// unset($query['task']);
// unset($query['id']) ;
// }
if ($id) {
$alias = AkrecipesFrontendHelper::getItemAlias($id, 'contests');
$segments[] = $alias;
unset($query['task']);
unset($query['catid']);
}
break;
case 'brands':
$segments[] = 'brands';
unset($query['task']);
unset($query['layout']);
unset($query['Itemid']);
break;
case 'brand':
$segments[] = 'brands';
// $model = AkrecipesFrontendHelper::getModel($view);
// if ( $model !== null) {
// $item = $model->getData($id);
// //$alias = $model->getAliasFieldNameByView($view);
// $segments[] = $item->alias;
// unset($query['task']);
// unset($query['id']) ;
// }
if ($id) {
$alias = AkrecipesFrontendHelper::getItemAlias($id, 'brands');
$segments[] = $alias;
unset($query['task']);
unset($query['catid']);
}
break;
default:
break;
}
//error_log("segments --> " . print_r($segments,true));
return $segments;
}