本文整理汇总了PHP中XenForo_Link::buildIntegerAndTitleUrlComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Link::buildIntegerAndTitleUrlComponent方法的具体用法?PHP XenForo_Link::buildIntegerAndTitleUrlComponent怎么用?PHP XenForo_Link::buildIntegerAndTitleUrlComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Link
的用法示例。
在下文中一共展示了XenForo_Link::buildIntegerAndTitleUrlComponent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildLink
/**
* Method to build a link to the specified page/action with the provided
* data and params.
*
* @see XenForo_Route_BuilderInterface
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
// for situations such as an array with thread and node info
if (isset($data['node_title'])) {
$data['title'] = $data['node_title'];
}
if ($data && isset($data['node_id']) && $data['depth'] === 0) {
if (!XenForo_Application::get('options')->categoryOwnPage) {
return new XenForo_Link('#' . XenForo_Link::buildIntegerAndTitleUrlComponent($data['node_id'], $data['title'], true));
}
}
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'node_id', 'title');
}
示例2: actionList
public function actionList()
{
//########################################
// list
//########################################
// get permission
if (!XenForo_Visitor::getInstance()->hasPermission('bookmarkGroupID', 'bookmarkID')) {
throw $this->getNoPermissionResponseException();
}
// get userId
$userId = XenForo_Visitor::getUserId();
// get options from Admin CP -> Options -> Bookmark -> Sort By
$sortBy = XenForo_Application::get('options')->bookmarkSortBy;
// get options from Admin CP -> Options -> Bookmark -> Sort Order
$sortOrder = XenForo_Application::get('options')->bookmarkSortOrder;
if ($sortBy == 'postDate') {
$orderBy = 'xf_post.post_date';
}
if ($sortBy == 'bookmarkDate') {
$orderBy = 'xf_bookmark.bookmark_id';
}
if ($sortOrder == 'desc') {
$orderSort = ' DESC';
}
if ($sortOrder == 'asc') {
$orderSort = ' ASC';
}
// get database
$db = XenForo_Application::get('db');
// run query
$bookmarkResults = $db->fetchAll("\n\t\tSELECT xf_bookmark.bookmark_id,\n\t\txf_post.post_id,\n\t\txf_post.user_id,\n\t\txf_post.username,\n\t\txf_node.node_id AS forum_id,\n\t\txf_node.title AS forum_title,\n\t\txf_thread.title,\t\t\n\t\txf_post.post_date,\n\t\txf_bookmark.note\n\t\tFROM xf_bookmark\n\t\tINNER JOIN xf_post ON xf_post.post_id = xf_bookmark.post_id\n\t\tINNER JOIN xf_thread ON xf_thread.thread_id = xf_post.thread_id\n\t\tINNER JOIN xf_node ON xf_node.node_id = xf_thread.node_id\n\t\tWHERE xf_bookmark.user_id = " . $userId . "\n\t\tAND xf_post.message_state = 'visible'\n\t\tORDER BY " . $orderBy . $orderSort . "\n\t\t");
// declare variable
$i = 0;
// get child node titles
foreach ($bookmarkResults as $k => $v) {
// includeTitleInUrls option
$forum_link = XenForo_Link::buildIntegerAndTitleUrlComponent($v['forum_id'], $v['forum_title'], true);
// merge arrays
$bookmarkResults[$i] = array_merge($bookmarkResults[$i], array('forum_link' => $forum_link));
// increment variable
$i = $i + 1;
}
// prepare viewParams
$viewParams = array('bookmarkResults' => $bookmarkResults);
// send to template
return $this->responseView('Andy_Bookmark_ViewPublic_Bookmark', 'andy_bookmark_list', $viewParams);
}