vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How can I fetch a post? (https://vborg.vbsupport.ru/showthread.php?t=226830)

MarkFoster 10-26-2009 07:09 PM

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>


Lynne 10-26-2009 08:11 PM

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.

MarkFoster 10-27-2009 12:29 PM

Quote:

Originally Posted by Lynne (Post 1906588)
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. :)

Lynne 10-27-2009 02:48 PM

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.

paul41598 10-27-2009 04:05 PM

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.

ragtek 10-27-2009 05:51 PM

Quote:

Originally Posted by MarkFoster (Post 1906852)
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);


All times are GMT. The time now is 05:12 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.01009 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete