PDA

View Full Version : Bizzare phpinclude problem


ixian
08-02-2002, 11:39 PM
Does anyone have any idea why when I add this:

ob_start();
include_once("./last10.php");
$last10 = ob_get_contents();
ob_end_clean();

To the phpincludes template, vb now automatically fills in the subject line on replies with titles from other threads? It's totally weird, and driving me and my users NUTS.

All I want to do is include the file last10.php in a template. Is there a better way to do it maybe?

This is with 2.2.6

Thank you!

Ixian

Admin
08-03-2002, 07:57 AM
Probably because last10.php populates the $subject variable when it's called.

A not-very-nice-but-works workaround:
function getLast10() {
global $last10;
ob_start();
include_once('./last10.php');
$last10 = ob_get_contents();
ob_end_clean();
}
getLast10();

ixian
08-03-2002, 02:53 PM
Chen once again proves he is the master.

It does work, and avoids the subject problem as well. Which leads me to ask, what's not nice about it? :)

Love that last10 hack of yours. I use it in two places - a new threads box at the top of my (non-php) homepage, where I renamed it to last5 and heavily edited it so it would only show very basic info and uses my CSS classes, and a separate instance I left intact as last10 that I am using in a template to provide an overal new post summary page with vb. I modified it a little, actually - added some more variables so I can make links for the forum name, etc different colors.

Thanks again!

Admin
08-03-2002, 04:09 PM
Well it's nice... it could be done more elegantly but what I gave was a quick fix. :)

(And psst... that's not my hack! ;))