Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Design and Graphics Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-22-2018, 12:23 AM
hilaryl hilaryl is offline
 
Join Date: Jan 2006
Location: Brisbane, Australia
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to add last post content snippet to New Posts list?

I'd like to add a snippet of the content of the last post in each thread to the list that's shown in New Posts. So I'd like to show the thread title, a snippet of the last post, the name of the last poster and then some thread stats.

I'm looking at the search_threadbit template.

I've got the title, thread status etc all working.

This is the top part of the code that I've got so far (it's not all of it so ignore if <div></div>s don't match up)...

Code:
<li class="imodselector threadbit {vb:if !$thread['del_username'], $thread['statusstring']}<vb:if condition="$show['paperclip']"> attachments</vb:if><vb:if condition="$show['inlinemod']"> inlinemod</vb:if><vb:if condition="!$thread['postuserid'] AND !$thread['del_userid']"> guest</vb:if><vb:if condition="$thread['moderatedprefix']"> unapproved</vb:if>" id="thread_{vb:raw thread.realthreadid}">
 <div class="icon{vb:raw thread.threadiconid} rating{vb:raw thread.rating}<vb:if condition="$thread['sticky']"> sticky<vb:else /> nonsticky</vb:if>{vb:if $thread['del_username'], ' deleted'}">
  <div class="threadinfo thread">
   <!--  status icon block -->
   <a class="threadstatus" rel="vB::AJAX" <vb:if condition="$show['threadcount']">title="{vb:rawphrase have_x_posts_in_thread_last_y, {vb:raw thread.dot_count}, {vb:raw thread.dot_lastpost}}"</vb:if>></a>
   <!-- title / author block -->
   <div class="inner">
    <h3 class="threadtitle">
     <vb:if condition="$thread['movedprefix'] OR $thread['typeprefix'] OR $thread['moderatedprefix'] OR $thread['prefix_rich']">
      <span class="prefix understate">
       {vb:raw thread.movedprefix}
       {vb:raw thread.moderatedprefix}
       {vb:raw thread.prefix_rich}
      </span>
     </vb:if>
     <a class="title<vb:if condition="$show['gotonewpost']"> threadtitle_unread</vb:if>" href="{vb:link thread, {vb:raw thread}, {vb:raw pageinfo_lastpost}, 'threadid', 'threadtitle'}#post{vb:raw thread.lastpostid}"><vb:if condition="$thread['sticky']"><span>STICKY</span></vb:if>{vb:raw thread.threadtitle}</a>
    </h3>
    <vb:if condition="$thread['status']">
     <div class="threadstatus">
      <vb:if condition="$show['subscribed'] OR THIS_SCRIPT == 'subscription'">
       <div class="threadstatusbit tstatus_subscribed" title="Subscribed"></div>
      </vb:if>
      <vb:each from="thread['status']" value="row">
       <vb:if condition="$row != 'hot'">
        <div class="threadstatusbit tstatus_{vb:raw row}" title="{vb:raw row}"></div>
       </vb:if>
      </vb:each>
     </div>
    <vb:else />
     <div class="threadstatus">
      <div class="threadstatusbit"></div>
     </div>
    </vb:if>
   </div>
   
   <!-- iconinfo -->
   <div class="threaddetails">
    <div class="threaddetailicons">
     <vb:if condition="$show['moderated']">
      Moderated
     </vb:if>
    </div>
   </div>

  </div>

  <vb:if condition="$thread['del_username']">
   <!-- deleted by -->
   <div class="threaddeleted td">
    <div class="inner">
     <div class="deletedby">
      {vb:rawphrase thread_deleted_by_x, {vb:link member, {vb:raw thread}, null, 'del_userid', 'del_username'}, {vb:raw thread.del_username}}
     </div>
     <vb:if condition="$show['deletereason']">
      <dl class="stats deletereason">
       <dt class="reason">{vb:rawphrase reason}</dt>
       <dd class="reason"> &nbsp;{vb:raw thread.del_reason}</dd>
      </dl>
     </vb:if>
    </div>
   </div>
  <vb:else />

   <!-- lastpost -->

     <div class="contact">

      <div class="userAvatar">       
       <a class="postuseravatarlink" href="{vb:link member, {vb:raw post}}" title="{vb:rawphrase {vb:raw post['onlinestatusphrase']}, {vb:raw post.username}}">
        <vb:if condition="$post.avatarurl && $show['avatar']">
         <img src="{vb:raw post.avatarurl}" alt="{vb:rawphrase xs_avatar, {vb:raw post.username}}" />
        <vb:else />
         <img src="/images/layout/noImageUser.jpg" />
        </vb:if>
       </a>
      </div>
     </div>

  {vb:raw template_hook.postbit_messagearea_start}
  <div class="postrow">

   <div class="content">
    <div id="post_message_{vb:raw post.postid}">
     <blockquote class="postcontent restore">
      {vb:raw post.message}
     </blockquote>
    </div>
</div>
</div>


   <div class="threadstatslatest">
      <span class="tlpuser">{vb:raw thread.lastposter}</span>
    <div class="threadlastpost">
<span class="tlptime">{vb:raw thread.lastposttime}</span> 
| <span class="tlpdate">{vb:raw thread.lastpostdate}</span>
| {vb:raw thread.replycount} <vb:if condition="$thread['replycount'] == 1">reply<vb:else />replies</vb:if>
| {vb:raw thread.forumtitle}

    </div>
    </div>
</vb:if>
Would the bit in blue show a post snippet if I can get it looking at the correct post?

And for the avatar bit in red, how do I change that code so it's looking at the avatar for the lastposter? (that bit of code is copied from postbits)

Thank you in advance to anyone who is better vb coder than me
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:14 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03811 seconds
  • Memory Usage 2,409KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (1)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete