inherit
16846
0
Nov 19, 2012 15:20:20 GMT -8
Chris
3,036
December 2003
cddude
|
Post by Chris on Jul 8, 2012 10:52:25 GMT -8
So, one of the big "sell points" of the new templating system is the ability to make a blog layout, or something similar (i.e. tutorials), out of a board. This is done by making the first post styled differently, and then making the remaining posts take on a "comments" look. Now, this brings up the case of pagination. "Wait, won't the first post on the second thread also have the tutorial look?!" Nope. Easy enough fix: (This is generic templating code; not necessarily PB code. ) {for posts as post} {if page == 1 && post.isFirstPost} /* Tutorial code here */ {else} /* Comment code here */ {/if} {/for} However, I can think of one small issue.... logically, the pagination now represents comments, not thread posts! This means the first post should remain visible at the top, similar to announcement threads... I'm requesting a template variable that allows the first post (AND ONLY THE FIRST) to remain at the top of subsequent pages of a thread. I'm open to any other ideas on how this could be rectified. I do understand that for administratively created content, it is possible to actually just hide the first post and instead show a blog based off thread ID (i.e. replace the tutorial code above with the tutorial, bypassing the posting system), but this just creates more problems with thread summary and would be a huge pain.
|
|
#e61919
1
0
1
Sept 28, 2023 13:31:20 GMT -8
VS Admin
20,147
January 2000
admin
|
Post by VS Admin on Jul 8, 2012 11:33:29 GMT -8
I believe you can already accomplish this in the system (or very near accomplish this), however there may be a couple tweaks we could do to make things easier. From what I can see right now, the page # does not appear to be a variable that is available, which we should probably change that.
Here's some sample code for reference, when viewing a thread (note that this code may be outdated, is subject to change, is not finished, etc etc):
Thread:
<div class="container manager posts $[thread.content_class]"> <div class="title-bar"> <h2>$[thread.subject]</h2> {if $[thread.could_reply]} <ul class="controls"><li>$[reply_button]</li></ul> {/if} </div> <div class="control-bar scrollable"> $[search] <div class="controls"> $[action_menu] </div> <div class="control-icons float-left">$[thread.icon_locked]$[thread.icon_falling]$[thread.icon_event]</div> $[pagination] </div> <div class="content cap-bottom"> <div id="labels" class="labels">$[thread.labels]</div> {if $[poll]}$[poll]{/if} <table class="list" cellpadding="0" cellspacing="0" role="presentation"> <tbody class="list-content"> $[post_list] {if !$[quick_reply]} <tr class=""><td class="reply_button center">$[reply_button]</td></tr> {/if} </tbody> </table> </div> </div>
$[quick_reply]
Post List:
{foreach $[post]} <tr id="$[post.content_id]" class="$[post.content_class]{if $[post.even]} even{/if}"> {if $[post.is_blocked]} <td class="blocked"> <table> <tr> <td class="left-panel" rowspan="2"> <div class="mini-profile blocked"> {if $[post.created_by.is_member]}$[post.created_by.link]{else}$[post.created_by.name]{/if}<br /> </div> </td> <td class="content"> <div class="content-head ui-helper-clearfix{if $[recent]} recent{/if}"> <div class="info{if $[recent]} recent{/if}"> {if $[recent]}<span class="thread-link">$[post.thread_link]</span><br />{/if} <span class="date{if !$[recent]} not-recent{/if}"> $[post.created_on] </span> {if $[post.how_posted]} <span class="post-method{if !$[recent]} not-recent{/if}"> via $[post.how_posted] </span> {/if} {if $[like_system_enabled]} <span id="span-$[post.like_id]" class="likes{if $[post.total_likes] > 0} liked{/if}{if !$[recent]} not-recent{/if}"> - <a><span class="total-likes">$[post.total_likes]</span> Like<span class="likes-s">{if $[post.total_likes] != 1}s{/if}</span></a> </span> {/if} </div> <div class="controls blocked"> <a id="blocked-post-$[post.id]" class="button display-blocked-post">Display Post</a> </div> </div> <div class="message blocked small note">This post is hidden</div> </td> </tr> <tr> <td class="foot"></td> </tr> </table> </td> {/if} <td class="unblocked"> <table alt="Post" role="grid"> <tr> <td class="left-panel" rowspan="2"> $[post.created_by.miniprofile] </td> <td class="content"> <div class="content-head ui-helper-clearfix{if $[recent]} recent{/if}"> <div class="info{if $[recent]} recent{/if}"> {if $[recent]}<span class="thread-link">$[post.thread_link]</span><br />{/if} <span class="date{if !$[recent]} not-recent{/if}"> $[post.created_on] </span> {if $[post.how_posted]} <span class="post-method{if !$[recent]} not-recent{/if}"> via $[post.how_posted] </span> {/if} {if $[like_system_enabled]} <span id="span-$[post.like_id]" class="likes likes-$[post.total_likes]"> - <a href="#"> <span class="likes-total">$[post.total_likes]</span> <span class="likes-singular">Like</span> <span class="likes-plural">Likes</span> </a> </span> {/if} </div> <div class="controls"> {if !$[hide_links]} {if $[post.could_reply]}<a href="$[post.quote_href]$[page]" class="button{if !$[post.can_reply]} guest-prompt{/if} quote-button in-thread-$[post.thread_id]" id="quote-button-$[post.id]">Quote</a>{/if} {if $[current_user.is_member]} {if $[post.edit_href]}<a href="$[post.edit_href]" class="edit-button button">Edit</a>{/if} {if $[like_system_enabled]}<a class="button likes-button{if $[post.user_liked]} liked{/if}"><img border="0" src="$[image.like.src]" alt="$[image.like.alt]" title="$[image.like.title]" /></a>{/if} {/if} $[post.select_options] {/if} </div> </div> <h3 class="title aria-hidden">Post by $[post.created_by.name] on $[post.created_on]</h3> <div class="message">$[post.body]</div> </td> </tr> <tr> <td class="foot"> {if $[post.edited_by]} <div class="edited_by"><span class="italic">Last Edit:</span> $[post.edited_on] by $[post.edited_by.link]{if $[post.updated_reason]}: $[post.updated_reason]{/if}</div> {/if} {if $[post.created_by.signature]}<div class="signature">$[post.created_by.signature]</div>{/if} </td> </tr> </table> </td> </tr> {/foreach} {if !$[post]} <tr class="last"><td class="last center" colspan="1">No posts were found.</td></tr> {/if}
Right now, to accomplish what you want, in the "Thread" template you could use $[thread.first_post.whatever] to access the first post's variables.
Then, in the Post List template, you could do something like:
{foreach $[post]} {if $[page] == 1} {if $[post.iteration] != 1} .. rest of the regular code.. {/if} {/if} {/foreach}
|
|
inherit
16846
0
Nov 19, 2012 15:20:20 GMT -8
Chris
3,036
December 2003
cddude
|
Post by Chris on Jul 8, 2012 11:59:24 GMT -8
;D Perfect. Thanks Pat.
|
|