本文整理汇总了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&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);
}
}