Discuss.Controllers.board
The board controller builds an overview of threads in a board.
Basic Information
Since Version | 1.0 |
Controller File | controllers/web/board.class.php |
Controller Class Name | DiscussBoardController
|
Controller Template | pages/board.tpl |
Manifest Name | board |
Options
If you don't know what the manifest is, please go back to the Getting Started document. The options below need to go into the "board" options array of the manifest.
Key | Default | Description |
---|---|---|
showSubBoards | When set to true, subboards will be available in the "boards" placeholder. When no boards are available, the "boards" placeholder will be empty and "boards_toggle" will have a value of "display: none;", which can be used to hide outer wrappers for subboards. | |
showReaders | When set to true, users viewing the board will be available in the "readers" placeholder. User needs discuss.view_online permission. Setting discuss.show_whos_online needs to be enabled. Text is built up from the users' username, wrapped in an <a> tag if the user has access to view profiles, with multiple people viewing joined together with a comma. | |
showModerators | When set to true, the moderators for the current board will be available in the "moderators" placeholder. The text in here will be built up from the users display or username, wrapped in an <a> tag if the viewer has access to view profiles, with multiple moderators joined together with a comma. | |
showPaginationIfOnePage | If there is only one page of threads, this switch decides if there should be a pagination available in the "pagination" placeholder or not. | |
board/getlist common options | ||
lastPostTpl | board/disLastPostBy | Chunk used to create the "lastpost" placeholder. This chunk gets fed the following placeholders:
|
subBoardTpl | board/disSubForumLink | Chunk used to loop over subforums to eventually fill the "subforums" placeholder after joined together with the value of the subBoardSeparator option. This chunk gets the following placeholders:
|
subBoardSeparator | comma and line break (\n) | Used to join together the subBoardTpl chunks to one string. |
categoryRowTpl | category/disCategoryLi | Chunk used to loop over categories. Gets the following placeholders:
|
boardRowTpl | board/disBoardLi | Chunk used to loop over boards. Gets the following placeholders:
|
checkUnread | true | When set to false, this board will not check if the user has read the posts in this forum and will simply mark them as read when not logged in, and unread when logged in. Note that this affects the unread and unread-cls placeholders for the boardRowTpl. |
Controller Template
This controller template has the following placeholders you can use, on top of the placeholders mentioned in the options above:
Placeholder | Description |
---|---|
All fields of the disBoard object. | |
posts | The posts in this board. |
boards | Sub boards of this forum, if available and enabled (see options above). |
boards_toggle | Either "display:none;" or empty depending on the value in boards. |
top | Empty unless set by plugin on OnDiscussRenderBoard event by using $modx->event->output(array('name-of-placeholder' => 'stuff')); |
bottom | See "top" placeholder. |
aboveThreads | See "top" placeholder. |
belowBoards | See "top" placeholder.
|
belowThreads | See "top" placeholder.
|
pagination | Pagination for this board. |
readers | Users viewing this board |
moderators | Moderators for this board |
trail | Breadcrumbs for this board |
actionbuttons | Actions avialable for the user. See note on actionbuttons on the Controllers page. |
[[+top]] <div> <form action="[[~[[*id]]]]search" method="GET"> <input type="hidden" name="board" value="[[+id]]" /> <input type="text" name="s" value="" style="width: 200px; margin-right: 5px;" placeholder="[[%discuss.search_this_board]]" /> <input type="submit" value="[[%discuss.search]]" /> </form> </div> [[+trail]] [[+aboveBoards]] <ol style="[[+boards_toggle]]"> [[+boards]] </ol> [[+belowBoards]] <br /> [[+actionbuttons]] <div><span>[[%discuss.pages? &namespace=`discuss` &topic=`web`]]:</span> <ul>[[+pagination]]</ul></div> <br /> <div> <div> <div> <div style="width: 25%">[[%discuss.last_post]]</div> <div style="width: 10%">[[%discuss.replies]]</div> <div style="width: 10%">[[%discuss.views]]</div> <div style="width: 55%;">[[%discuss.message]]</div> </div> <br /> </div> <ol> [[+posts]] </ol> </div> <br /> [[+actionbuttons]] <div><span>[[%discuss.pages]]:</span> <ul>[[+pagination]]</ul></div> [[+belowThreads]] <p>[[+readers]]</p> <p>[[+moderators]]</p> <p>[[+trail]]</p> [[+bottom]]
System Events
OnDiscussRenderBoard
All currently set placeholders are available through the $placeholders array. The return value or $modx->event->output() value is expected to be an array of placeholders to override. Using a plugin on this event is the only way to put a value in the top, bottom, aboveThreads, belowThreads, aboveBoards and belowBoards placeholders.
Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).