Well I'm making some progress at least,.. you've got it working- which I owe you millions of thanks for, but I'm having an issue of it parsing a little to much onto the page.
I'll break down what I'm trying to accomplish.
The test.php page calls a new template called test,.
The test template calls a plugin named $homepage_recent_post,..
$homepage_recent_post displays:
7 recent threads from specific subforums,
Display the thread title,
Display the date posted,
Display who posted it,
Display the pagetext, (the post itself),
Display a link to that thread.
If I setup my test.php page like:
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE & ~8192);
// ######################### REQUIRE BACK-END ############################
require_once('global.php');
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'test'); // change this depending on this files name
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array('TEST',);
// pre-cache templates used by specific actions
$actiontemplates = array();
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
eval('print_output("' . fetch_template('TEST') . '");');
?>
With this plugin:
PHP Code:
$numposts='7';
$thrdqry = $vbulletin->db->query_read("
SELECT thread.threadid, thread.title, username, post.dateline, post.pagetext FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "post AS post ON thread.firstpostid = post.postid
WHERE thread.forumid IN (61, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 130, 131, 132, 133, 134, 136, 137, 138, 139) AND thread.visible = '1'
ORDER BY thread.dateline DESC
LIMIT 0, $numposts ");
while ($thrds = $vbulletin->db->fetch_array($thrdqry))
{
$postdate = vbdate($vbulletin->options['dateformat'], $thrds['dateline'], true);
$posttime = vbdate($vbulletin->options['timeformat'], $thrds['dateline']);
$homepage_recent_post .=<<<EOD
<div class="post-1 post type-post hentry category-uncategorized" id="post-1">
<h2 class="title"><a href="showthread.php?t=$thrds[threadid]" target="_blank" alt="$thrds[title]" title="$thrds[title]">
$thrds[title]
</a>
</h2>
<div class="postdate">
<img src="images/date.png" /> $postdate <img src="images/user.png" /> $thrds[username]
</div>
<div class="entry">
<p>$thrds[pagetext]</p><a href="showthread.php?t=$thrds[threadid]" target="_blank" alt="$thrds[title]" title="$thrds[title]">
Read more..
</a><br/><br/>
</div>
</div>
EOD;
}
I'll get the 7 last post, but they're unparsed.
Now if I setup my test.php like:
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE & ~8192);
// ######################### REQUIRE BACK-END ############################
require_once('global.php');
require_once('includes/class_bbcode.php');
$bbcode_parser =& new vB_BbCodeParser($GLOBALS['vbulletin'], fetch_tag_list(),true);
$homepage_recent_post= $bbcode_parser->parse($homepage_recent_post ,'nonforum', true);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'test'); // change this depending on this files name
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array('TEST',);
// pre-cache templates used by specific actions
$actiontemplates = array();
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
eval('print_output("' . fetch_template('TEST') . '");');
?>
and with the same $homepage_recent_post plugin, it'll parse the plugin- pagetext
and all, but then it's parsing too much onto my page. Here's an example of the same post from above, but parsed.
Is there any way to parse just post.pagetext onto this page instead of parsing the entire plugin? If so, how do I go about doing it?