本文整理汇总了PHP中Tags::getTagUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Tags::getTagUrl方法的具体用法?PHP Tags::getTagUrl怎么用?PHP Tags::getTagUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags::getTagUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_object_tags
/**
* Render object tags
*
* Parameters:
*
* - object - Selected object
* - project - Selected project, if not present we'll get it from
* $object->getProject()
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_object_tags($params, &$smarty)
{
$object = array_var($params, 'object');
if (!instance_of($object, 'ProjectObject')) {
return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true);
}
// if
$project = array_var($params, 'project');
if (!instance_of($project, 'Project')) {
$project = $object->getProject();
}
// if
if (!instance_of($project, 'Project')) {
return new InvalidParamError('project', $project, '$project is expected to be an instance of Project class', true);
}
// if
$tags = $object->getTags();
if (is_foreachable($tags)) {
$prepared = array();
foreach ($tags as $tag) {
if (trim($tag)) {
$prepared[] = '<a href="' . Tags::getTagUrl($tag, $project) . '">' . clean($tag) . '</a>';
}
// if
}
// if
return implode(', ', $prepared);
} else {
return '<span class="no_tags">' . lang('-- No tags --') . '</span>';
}
// if
}
示例2: view
/**
* Show single tag
*
* @param void
* @return null
*/
function view()
{
$tag = urldecode($this->request->get('tag'));
$tags = Tags::buildIndex($this->active_project);
$per_page = 30;
$page = (int) $this->request->get('page');
if ($page < 1) {
$page = 1;
}
// if
list($objects, $pagination) = ProjectObjects::paginateByIds($tags[$tag]['objects'], $page, $per_page, STATE_VISIBLE, $this->logged_user->getVisibility());
$this->smarty->assign(array('tag' => $tag, 'objects' => $objects, 'pagination' => $pagination, 'tag_url_pattern' => Tags::getTagUrl($tag, $this->active_project, '-PAGE-')));
}