CForumTopic::GetNeighboringTopics
array CForumTopic::GetNeighboringTopics( int TID, array arUserGroups );
The method GetNeighboringTopics returns the ID's of the neighboring topics (previous and next ones) for a specified forum topic. The topics are sorted by the date of the last message (standard sorting) considering the access permissions of the specified user groups.
Parameters
Parameter | Description |
---|---|
TID | The ID of the topic whose neighbor topics ID's are to be returned. |
arUserGroups | Array of user group ID's used to consider access permissions. Usually, the ID's of the groups whose member the current user is. |
Return Values
The method returns an array containing two elements. The first element is the ID of the previous topic, the second is the ID of the following one. If any of the neighbors does not exist for this topic, zero is returned in either first or second array entry.
Example
<? // Display the links to the neighboring topics // for the topic TID with respect to the current user permissions list($iPREV_TOPIC, $iNEXT_TOPIC) = CForumTopic::GetNeighboringTopics($TID, $USER->GetUserGroupArray()); if ($iPREV_TOPIC > 0) echo "<a href=\"read.php?fid=".$fid."&tid=".$iprev_topic."\">"; echo "Previous topic"; if ($iPREV_TOPIC > 0) echo "</a>"; echo " | "; if ($iNEXT_TOPIC > 0) echo "<a href=\"read.php?fid=".$fid."&tid=".$inext_topic."\">"; echo "Next topic"; if ($iNEXT_TOPIC > 0) echo "</a>"; ?>
© «Bitrix24», 2001-2024