当前位置: 首页>>代码示例>>PHP>>正文


PHP AkrecipesFrontendHelper::getItemAlias方法代码示例

本文整理汇总了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;
 }
开发者ID:rutvikd,项目名称:ak-recipes,代码行数:101,代码来源:router.php


注:本文中的AkrecipesFrontendHelper::getItemAlias方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。