本文整理匯總了PHP中KunenaRoute::getCategoryItemid方法的典型用法代碼示例。如果您正苦於以下問題:PHP KunenaRoute::getCategoryItemid方法的具體用法?PHP KunenaRoute::getCategoryItemid怎麽用?PHP KunenaRoute::getCategoryItemid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類KunenaRoute
的用法示例。
在下文中一共展示了KunenaRoute::getCategoryItemid方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getUri
/**
* @param mixed $category
* @param string $action
*
* @return JUri|null
*/
public function getUri($category = null, $action = null)
{
$category = $category ? KunenaForumCategoryHelper::get($category) : $this->getCategory();
$Itemid = KunenaRoute::getCategoryItemid($category);
if (!$this->exists() || !$category->exists()) {
return null;
}
if ($action instanceof KunenaForumMessage) {
$message = $action;
$action = 'post' . $message->id;
}
$uri = JUri::getInstance("index.php?option=com_kunena&view=topic&catid={$category->id}&id={$this->id}&action={$action}&Itemid={$Itemid}");
if ($uri->getVar('action') !== null) {
$uri->delVar('action');
$mesid = 0;
$limit = max(1, intval(KunenaFactory::getConfig()->messages_per_page));
if (isset($message)) {
$mesid = $message->id;
} elseif ((string) $action === (string) (int) $action) {
if ($action > 0) {
$uri->setVar('limitstart', $action * $limit);
}
} else {
switch ($action) {
case 'first':
$mesid = $this->first_post_id;
break;
case 'last':
$mesid = $this->last_post_id;
break;
case 'unread':
// Special case, improves caching
$uri->setVar('layout', 'unread');
// $mesid = $this->lastread ? $this->lastread : $this->last_post_id;
break;
}
}
if ($mesid) {
if (KunenaUserHelper::getMyself()->getTopicLayout() != 'threaded' && $mesid > 0) {
$uri->setFragment($mesid);
$limitstart = intval($this->getPostLocation($mesid) / $limit) * $limit;
if ($limitstart) {
$uri->setVar('limitstart', $limitstart);
}
} else {
$uri->setVar('mesid', $mesid);
}
}
}
return $uri;
}