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


PHP PMF_Link::setItemProperty方法代码示例

本文整理汇总了PHP中PMF_Link::setItemProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Link::setItemProperty方法的具体用法?PHP PMF_Link::setItemProperty怎么用?PHP PMF_Link::setItemProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMF_Link的用法示例。


在下文中一共展示了PMF_Link::setItemProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPath

 /**
  * Gets the path from root to child as breadcrumbs
  *
  * @param integer $id                Category ID
  * @param string  $separator         Path separator
  * @param boolean $renderAsMicroData Renders breadcrumbs as HTML5 microdata
  * @param string  $useCssClass       Use CSS class "breadcrumb"
  * @return string
  */
 public function getPath($id, $separator = ' / ', $renderAsMicroData = false, $useCssClass = 'breadcrumb')
 {
     global $sids;
     $ids = $this->getNodes($id);
     $num = count($ids);
     $temp = $catid = $desc = $breadcrumb = [];
     for ($i = 0; $i < $num; $i++) {
         $t = $this->getLineCategory($ids[$i]);
         if (array_key_exists($t, $this->treeTab)) {
             $temp[] = $this->treeTab[$this->getLineCategory($ids[$i])]['name'];
             $catid[] = $this->treeTab[$this->getLineCategory($ids[$i])]['id'];
             $desc[] = $this->treeTab[$this->getLineCategory($ids[$i])]['description'];
         }
     }
     if (isset($this->treeTab[$this->getLineCategory($id)]['name'])) {
         $temp[] = $this->treeTab[$this->getLineCategory($id)]['name'];
         $catid[] = $this->treeTab[$this->getLineCategory($id)]['id'];
         $desc[] = $this->treeTab[$this->getLineCategory($id)]['description'];
     }
     // @todo Maybe this should be done somewhere else ...
     if ($renderAsMicroData) {
         foreach ($temp as $k => $category) {
             $url = sprintf('%s?%saction=show&amp;cat=%d', PMF_Link::getSystemRelativeUri(), $sids, $catid[$k]);
             $oLink = new PMF_Link($url, $this->_config);
             $oLink->text = sprintf('<span itemprop="title">%s</span>', $category);
             $oLink->itemTitle = $category;
             $oLink->tooltip = $desc[$k];
             $oLink->setItemProperty('url');
             if (0 == $k) {
                 $oLink->setRelation('index');
             }
             $breadcrumb[] = sprintf('<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">%s</li>', $oLink->toHtmlAnchor());
         }
         $temp = $breadcrumb;
         return sprintf('<ul class="%s">%s</ul>', $useCssClass, implode('', $temp));
     } else {
         return implode($separator, $temp);
     }
 }
开发者ID:maggiofrancesco,项目名称:phpMyFAQ,代码行数:48,代码来源:Category.php


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