View Single Post
  #1300  
Old 12-20-2010, 07:18 PM
just.b.jealous just.b.jealous is offline
 
Join Date: Aug 2009
Location: Middle of no where.
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01442 seconds
  • Memory Usage 1,830KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete