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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-16-2011, 04:32 AM
thecrazycanuck thecrazycanuck is offline
 
Join Date: Jul 2010
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Please Help: Trying to modify recent post hack to add post previews on front page

I am using this mod to add a list of the most recently posted threads at my forum ebeaver.

I am trying to add a preview of the thread's first post under the given titles, but I am having a hard time figuring out how to query? this out of vbulletin.

Quote:
<td class="alt2">
<vb:if condition="$getposts_thread[newpost]">
<a href="showthread.php?{vb:raw session.sessionurl}goto=newpost&amp;t={vb:raw getposts_thread.threadid}" id="thread_gotonew_{vb:raw getposts_thread.realthreadid}"><img class="inlineimg" src="images/statusicon/post_new.gif" alt="{vb:rawphrase go_to_first_new_post}" border="0" /></a></vb:if>
{vb:raw getposts_thread.prefix_rich}
<a href="showthread.php?{vb:raw session.sessionurl}t={vb:raw getposts_thread.threadid}{vb:raw getposts_thread.highlight}" id="thread_title_{vb:raw getposts_thread.realthreadid}"<vb:if condition="$getposts_thread[newpost]"> style="font-weight:bold"</vb:if> title="{vb:raw getposts_thread.titletrimmed}">{vb:raw getposts_thread.titletrimmed}</a>

<div style="clear:both; border:1px dashed #c4c4c4; padding:10px; margin:10px 5px 5px 5px; background-color:#fefdf2;">
{vb:raw getposts_thread.pagetext}
</div>

</td>
<td align="center" class="alt1"><a href="forumdisplay.php?{vb:raw session.sessionurl}f={vb:raw getposts_thread.forumid}">{vb:raw getposts_thread.forumtitle}</a>
</td>
<td class="alt2" align="center">
{vb:raw getposts_thread.lastpostdate}
<vb:if condition="!$show['detailedtime']">
{vb:raw getposts_thread.lastposttime}</vb:if>
</td>
<td class="alt1" align="center">
<a href="misc.php?do=whoposted&amp;t={vb:raw getposts_thread.threadid}" onclick="who({vb:raw getposts_thread.threadid}); return false;">
{vb:raw getposts_thread.replycount}</a>
</td>
<td class="alt2" align="center">
{vb:raw getposts_thread.views}
</td>
</tr>
The bold div is in the right place to put the preview where I want, the part that I have no idea about is the {vb:raw getposts_thread.pagetext} I have also tried {vb:raw post.pagetext}

Can anyone point me in the right direction?
Reply With Quote
  #2  
Old 03-16-2011, 04:54 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is your Query? Are you even getting the pagetext in your query? And, after you do so, you need to format it and sometimes the coder changes the name of the field at that point. So, you'll have to look at your query and the code under it to figure out the correct variable to call.
Reply With Quote
  #3  
Old 03-16-2011, 05:17 PM
thecrazycanuck thecrazycanuck is offline
 
Join Date: Jul 2010
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no I am certainly not getting the pagetext. I get zip from that code My problem is that I really have no idea what variable I have to call. I know that for displaying this the thread display template the variable is post.pagetext.

So I know that this may not be possible with only one variable call but I know I need to call the pagetext from the first post of the thread. (I hope that made sense) My difficulty is that the hack doesn't call any of the vbulletin native variables for posts that can be called but I can't find any relevant documentation on the native variables that would let me call posts or posts pagetext.

I hope I made sense here, I am a bit of a code noob.
Reply With Quote
  #4  
Old 03-16-2011, 06:10 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are no 'native' variables to be used there. The only variables you may use are ones that you define. So, you need to go look at your php code and see what variables are defined. You can't just throw variables names out and hope they give you something. Well, I suppose you can do that, but you shouldn't be surprised if they give you nothing.
Reply With Quote
  #5  
Old 03-16-2011, 06:27 PM
thecrazycanuck thecrazycanuck is offline
 
Join Date: Jul 2010
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok, then, I suppose my problem is that I don't know for instance if there is a db query that would let me id the first post in a thread.

I am looking for information on how vbulletin stores all the thread and post data in the database so I can call it. or am I just showing my ignorance of php and sql?
Reply With Quote
  #6  
Old 03-16-2011, 07:44 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The query is in the mod. You said you were using a mod and trying to modify the output. Well, the output comes from the code in the mod. So, you need to look at the modification code to see what the query is and what he is actually selecting and if the post text is one of the things being selected (probably not). If not, then you need to add it.
Reply With Quote
  #7  
Old 03-18-2011, 04:56 AM
thecrazycanuck thecrazycanuck is offline
 
Join Date: Jul 2010
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok, so the mod selects variables from the thread table so I added in a query for firstpostid, and I am adding in a query of the post table to select for the post's pagetext.

My problem now is how to use the firstpostid from the thread table query to properly select the pagetext from the post table query
Reply With Quote
  #8  
Old 03-18-2011, 04:26 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

SELECT pagetext FROM post WHERE postid = $firstpostid

You will need to format that correctly. You could probably just use a JOIN in your original query to grab that depending on what the query looks like.
Reply With Quote
Reply


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 01:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10214 seconds
  • Memory Usage 2,233KB
  • Queries Executed 11 (?)
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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (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_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • 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
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete