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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-14-2008, 10:44 PM
Gladius2007 Gladius2007 is offline
 
Join Date: Nov 2007
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to get this php code into a plugin?

Pretty simple question, but I can't figure it out... the original code is

PHP Code:
  <?php require_once('/home/path/file.php'); ?>
       <?php output_NewestThreads(10,"36"); ?>
I'm using it on a regular php page to display latest threads (properly, not how most hacks do it). I can't seem to get it to work in a plugin though, so that I could use it on the board pages too... I've tried several variants that I could think of, but nothing works (getting blank pages). Can anyone point me in the right direction? Thanks.
Reply With Quote
  #2  
Old 07-14-2008, 10:55 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="http://www.vbulletin.com/docs/html/main/templates_externalfiles" target="_blank">Including External Files</a>
Reply With Quote
  #3  
Old 07-15-2008, 12:24 AM
Gladius2007 Gladius2007 is offline
 
Join Date: Nov 2007
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've seen that, yes, but if you look at the code you'll see that those instructions aren't any help with the output_NewestThreads bit and the code as a whole. This is a bit more complicated...
Reply With Quote
  #4  
Old 07-15-2008, 08:10 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
ob_start();
require_once(
'/home/path/file.php');
output_NewestThreads(10,"36");
$includedphp ob_get_contents();
ob_end_clean(); 

Tired that? (use the global_setup_complete hook, global_start is useless when things go wrong).
Reply With Quote
  #5  
Old 07-15-2008, 02:27 PM
Gladius2007 Gladius2007 is offline
 
Join Date: Nov 2007
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's exactly the code I've been trying, but wherever I use it, the page goes blank... I've been using global_start and now tried with global_setup_complete and it was the same thing - completely blank page, i.e. it kills the entire page.
Reply With Quote
  #6  
Old 07-15-2008, 03:08 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm, try it on a random page see if it works there. Else put it directly in a vBulletin PHP file temporarily and try it then.
Reply With Quote
  #7  
Old 07-15-2008, 04:20 PM
Gladius2007 Gladius2007 is offline
 
Join Date: Nov 2007
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What kind of a random page do you mean?

And which vB file would I be least likely to mess up to test it in? I haven't modified any vB files before and I'm not a coder so...
Reply With Quote
  #8  
Old 07-15-2008, 07:48 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Set up a separate test board and develop on there.

(By random page I mean just a normal plain PHP Page)
Reply With Quote
  #9  
Old 07-15-2008, 10:21 PM
Gladius2007 Gladius2007 is offline
 
Join Date: Nov 2007
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I've tried using this code, and I get a blank page on a test page too:

PHP Code:
<?php
ob_start
();
require_once(
'/home/path/file.php');
output_NewestThreads(10,"36");
$includedphp ob_get_contents();
ob_end_clean(); 

bla bla $includedphp bla bla
?>
I'm not sure if my code there is as it should be to use on a separate page though.
Reply With Quote
  #10  
Old 07-16-2008, 10:01 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you want to get the latest threads, you can just query the database.
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 01:09 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.04858 seconds
  • Memory Usage 2,255KB
  • 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
  • (3)bbcode_php
  • (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