Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-30-2009, 10:05 PM
MarkFoster MarkFoster is offline
 
Join Date: Jun 2008
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Fetch post?

Is there anyways, whatsoever. That I will be able to fetch a post from the forums and put it on a custom page?

Like a code for this specific message?
Reply With Quote
  #2  
Old 05-30-2009, 10:15 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sure, with a query. If you have the postid, just make a query to the database for the message text. Just look up the query in showpost.php (the page for grabbing a single post, like you mentioned)
Reply With Quote
  #3  
Old 05-30-2009, 10:29 PM
MarkFoster MarkFoster is offline
 
Join Date: Jun 2008
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Sure, with a query. If you have the postid, just make a query to the database for the message text. Just look up the query in showpost.php (the page for grabbing a single post, like you mentioned)
If I'm not wrong you mean the vBulletin CP function called "Execute SQL Query", right?
However I'm not good at this. Or knowing. Are you telling me I have to make a code via looking at the "showpost.php" and put it through the SQL thing and then put it in the template?

I'd rather get a little more help here, please
Reply With Quote
  #4  
Old 05-30-2009, 10:42 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, I am saying you will have to do the "SQL thing" in order to grab the post. I'm suggesting you look in the showpost.php page because they used the same query there that you will need to use.
Reply With Quote
  #5  
Old 05-30-2009, 10:51 PM
MarkFoster MarkFoster is offline
 
Join Date: Jun 2008
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Yes, I am saying you will have to do the "SQL thing" in order to grab the post. I'm suggesting you look in the showpost.php page because they used the same query there that you will need to use.
I looked at the showpost.php. Three times. But I'm not sure what I should take. I'm sorr.y I'm just not any good at this.

--------------- Added [DATE]1243728398[/DATE] at [TIME]1243728398[/TIME] ---------------

It's really hard for me to figure out.
Could it possibly be related to this?
Code:
if ($postbit_obj->cachable)
{
	/*insert query*/
	$db->shutdown_query("
		REPLACE INTO " . TABLE_PREFIX . "postparsed (postid, dateline, hasimages, pagetext_html, styleid, languageid)
		VALUES (
			$post[postid], " .
			intval($threadinfo['lastpost']) . ", " .
			intval($postbit_obj->post_cache['has_images']) . ", '" .
			$db->escape_string($postbit_obj->post_cache['text']) . "', " .
			intval(STYLEID) . ", " .
			intval(LANGUAGEID) . "
			)
	");
}
Reply With Quote
  #6  
Old 05-31-2009, 01:08 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I hate to tell you, but it's the big huge one that starts on line 124. That is the basic query that gets *everything* needed to spit out the post - the post itself, the userinfo regarding the person who posted it, the sig, the avatar, etc.... You never said how much of the post you want - just the message text? If so, you can get rid of anything there regarding userinfo/avatar/signature/spamlog/userfield/editlog/sigparsed/usertextfield.
Reply With Quote
  #7  
Old 05-31-2009, 03:53 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[sql]SELECT *
FROM post AS p
LEFT JOIN user USING (userid)
LEFT JOIN userfield USING (userid)
WHERE p.postid = X[/sql]
That will fetch one specific post and associated user data. Note that the post will not have been parsed for BB code. If you have the knowledge/time, you may want to investigate fetching the cached post if available.
Reply With Quote
  #8  
Old 05-31-2009, 04:25 AM
MarkFoster MarkFoster is offline
 
Join Date: Jun 2008
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
[sql]SELECT *
FROM post AS p
LEFT JOIN user USING (userid)
LEFT JOIN userfield USING (userid)
WHERE p.postid = X[/sql]
That will fetch one specific post and associated user data. Note that the post will not have been parsed for BB code. If you have the knowledge/time, you may want to investigate fetching the cached post if available.
Okay. So lets say I put this in my SQL:
Code:
SELECT *
FROM post AS p
LEFT JOIN user USING (userid)
LEFT JOIN userfield USING (userid)
WHERE p.postid = 12066
Then what's the code I have to use to make it appear on the page?
Reply With Quote
  #9  
Old 05-31-2009, 06:18 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Providing you use query_first() to perform the query, all the data is inside the variable you assign it to. Open up the post table in phpMyAdmin (or similar) and see the structure.
Reply With Quote
  #10  
Old 05-31-2009, 06:32 AM
MarkFoster MarkFoster is offline
 
Join Date: Jun 2008
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
Providing you use query_first() to perform the query, all the data is inside the variable you assign it to. Open up the post table in phpMyAdmin (or similar) and see the structure.
I'm not good at this. I tried to look for something but I couldn't. Anymore help with be appreciated.
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 12:33 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.06981 seconds
  • Memory Usage 2,263KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete