MyBB Community Forums

Full Version: output_page does not show page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to help another member with an extension involving both forumdisplay and showthread. After some problems the forumdisplay part works, but now when a threadlink is clicked, showthread only shows a blank page (the correct url is shown in the address bar).

When I add some debug output to showthread, it appears that the whole script up to and including the call to and return from the script output_page at the end, is executed. This means that the echo at the end of output_page does not produce any output (also checked that this is executed).

I hope that MyBB programming cracks will recognize this behaviour!!


EDIT
I just see that when I add an echo just before output_page is called in showthread, the output of this echo is shown on the blank page.

EDIT 2
I now see that the complete contents of the page ($showthread) is empty.

EDIT 3
The only reason that I can think of, why the showthread template does not produce output, is that there are special forumdisplay and showthread templates used through XThreads.
I had first a similar problem with forumdisplay but that was solved by an unclear reason.

EDIT 4
I have dumped the template forumdisplay just before the eval statement in showthread, and this is the correct (XThreads version of this) template.
Question is now, how come that the eval produces blank output?

EDIT 5
All of the sudden the output of eval ($showthread) was the complete html of the page. However, it was not echoed by output_page. After rechecking, this only occurred once, and when I run the identical script again, the output of eval is again blank.
Can't really tell anything without seeing the code. We can only guess that you're either using a wrong hook or anything similar.
(2015-08-17, 06:41 PM)Destroy666 Wrote: [ -> ]Can't really tell anything without seeing the code. We can only guess that you're either using a wrong hook or anything similar.

I was busy making a showcase, but now suddenly it even doesn't open showthread anymore, although de address bar of the browser shows a good url:

http://xxxxxxxxxxx/showthread.php?tid=249


I am going to look further to the cause of this.

It's getting more and more strange.
Because showthread.php didn't no anything at all anymore, I have restored all php files to their original 1.8.05 versions. File Verification does acknowledge that (only 2 language files have been changed).

But still, when I try to run showthread by clicking a thread in forumdisplay, I arrive at a blank page and nothing happens (the address bar gives the correct url).

I hope someone recognizes this problem, and can give a clue how to solve this. When a technical staff member can do something with admin access, I can PM that.

EDIT
With a few echo's I found out that the showthread script is being executed, but that the output that is sent to Output_page is again blank.
I have done my best to document my problem better. At the end of the showthread.php script I dit put some debug output:


	$plugins->run_hooks("showthread_end");
	
	$file = fopen ("z_debug", "w");
	fwrite ($file, "thread ".$thread['tid']." with subject: ".$thread['subject']."\n");
	fwrite ($file, "start template showthread\n".$templates->cache['showthread']."\nend template showthread\nvar_dump of \$showthread after eval\n");
	
	eval("\$showthread = \"".$templates->get("showthread")."\";");
	
	ob_start();
	var_dump($showthread);
	fwrite ($file, ob_get_clean());
	fclose ($file);
	
	output_page($showthread);
}


First I wrote the thread number (tid) and subject to check whether the thread variables were OK

Then I dumped the showthread template, ecause I wanted to be sure that this was OK too.

After the evaluation (eval) of this template I did a var_dump of the output, variable $showthread. And this appeard to be a NULL variable, which is consitent with the blank page that I get.
Below the debug output (I have shortened it by deleting the middle part of the template text):


thread 2 with subject: InterUnion's Standard Pricing
start template showthread
<html>
<head>
<title>{$thread['subject']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
	var quickdelete_confirm = "{$lang->quickdelete_confirm}";
// -->
</script>
<script type="text/javascript" src="jscripts/thread.js?ver=1400"></script>
</head>
<body>
	{$header}

COMPLETE TEMPLATE SHOWTHREAD

	{$footer}
</body>
</html>
end template showthread
var_dump of $showthread after eval
NULL
Perhaps somebody (of the Technical Staff) who recognizes this. I surely hope so Huh .
I've just solved it by adding curly brackets between the (incomplete) variable $thread['fid10'] in the tradedeals_showthread template. My