當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tags::getTagUrl方法代碼示例

本文整理匯總了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
}
開發者ID:NaszvadiG,項目名稱:activecollab_loc,代碼行數:45,代碼來源:function.object_tags.php

示例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-')));
 }
開發者ID:NaszvadiG,項目名稱:activecollab_loc,代碼行數:19,代碼來源:TagsController.class.php


注:本文中的Tags::getTagUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。