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 10-26-2009, 07:09 PM
MarkFoster MarkFoster is offline
 
Join Date: Jun 2008
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I fetch a post?

How can I fetch a post to put on my custom page liek this:
HTML Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<table class="tborder" id="group0" cellpadding="6" cellspacing="1" border="0" width="100%">
<thead>
<tr>
<td class="tcat" colspan="3" rowspan="3"></td>
</tr>
</thead>
<tr>
<td class="alt2Active" id="u15" width="25%">
 
<!-- Image for game -->
<div>
<p>
<font size="1" face="Verdana">
<center>
<img src="" width="200" height="250">
<br></center>
<br><b>Title:</b> 
<br><b>Console:</b> XBox 360
<br><b>Genre:</b> Beat 'em up<br><b>Players:</b> 1
<br>
<br><b>Release dates:</b>
<br>North America: 
<br>Europe: 
<br>Japan: 
</font>
</p>
</div>
</td>

<td class="alt1"  width="75%" >

[B]FETCHED POST HERE![/B]

</div>
</td>
</table>

$footer
</body>
</html>
Reply With Quote
  #2  
Old 10-26-2009, 08:11 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would have to write a query to grab the post. I assume you have a php page to go along with that template, so you would put the query into the php page.
Reply With Quote
  #3  
Old 10-27-2009, 12:29 PM
MarkFoster MarkFoster is offline
 
Join Date: Jun 2008
Posts: 305
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
You would have to write a query to grab the post. I assume you have a php page to go along with that template, so you would put the query into the php page.
I absolutely have no experience with query's. I assume I put this inside my PHP file for the page:
Code:
SELECT *
FROM post AS p
LEFT JOIN user USING (userid)
LEFT JOIN userfield USING (userid)
WHERE p.postid = 12066
but I need to know exactly where to place the code on the PHP page. I use this: https://vborg.vbsupport.ru/showthread.php?t=62164

And not only that, I'm pretty sure the post odesn't "jump" up on the page on it's own. I'm pretty sure I need to add soem type of code in the template as well.

I hope you can help me.
Reply With Quote
  #4  
Old 10-27-2009, 02:48 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would put the query after it says "Start Main Page".... or basically after the global.php page is included and before the template is evaled. You can see what a query should look like by looking at other modifications or in the vbulletin php pages. You just need to use the query_first type of query (like I said, look it up in the vbulletin php pages). Really, the best way to learn how to do this is to see how it is done in vbulletin or a modification.
Reply With Quote
  #5  
Old 10-27-2009, 04:05 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yup, run your select query, and then do something like a:

PHP Code:
eval('$variablebits .= "' fetch_template('template_name') . '";'); 
with all your data in the template.
Reply With Quote
  #6  
Old 10-27-2009, 05:51 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkFoster View Post
I absolutely have no experience with query's. I assume I put this inside my PHP file for the page:
Code:
SELECT *
FROM post AS p
LEFT JOIN user USING (userid)
LEFT JOIN userfield USING (userid)
WHERE p.postid = 12066
but I need to know exactly where to place the code on the PHP page. I use this: https://vborg.vbsupport.ru/showthread.php?t=62164

And not only that, I'm pretty sure the post odesn't "jump" up on the page on it's own. I'm pretty sure I need to add soem type of code in the template as well.

I hope you can help me.
You could use fetch_postinfo($postid)!

$post = fetch_postinfo($postid);
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 03:17 PM.


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.04084 seconds
  • Memory Usage 2,222KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_php
  • (2)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
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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