MyBB Community Forums

Full Version: Function outputpage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, like I said here

http://community.mybboard.net/showthread...4#pid28104

I have some problems. Could anybody try to explain to me why u use an own created function (outputpage) instead of echo? Obviously it is necessary Smile. I could't find where that function is defined or what it does.
The outputpage function is defined in the inc/functions.php file.

Basically, the function is used to ensure that the page outputs correctly according to the user that is viewing it. For example, the function replaces <debugstuff> in the footer template with the general debugging information if the user is an admin. If not, the tag is ignored and nothing is displayed there. The function is also used for handling GZIP compression and so on.

Once the function has prepared the final page output, the contents can then be echoed. Wink

I've just taken a look at your other thread too and believe I see where the problem lies. The outputpage function should really only be called once to output an entire page rather than individual templates. To try and use your mod as an example, a way to avoid your problem would be to create a new template simply called "galerie", or whatever you choose (but I'll assume "galerie" for this example).

The new gallery template could contain your variables $galerie_top and $galerie_bottom. After you call this in your script...

eval("\$galerie_top = \"".$templates->get("galerie_top")."\";");
eval("\$galerie_bottom = \"".$templates->get("galerie_bottom")."\";");

...also call the new template...

eval("\$galerie = \"".$templates->get("galerie")."\";");

Then finally, use outputpage($galerie) to output your page.

In doing so, you are essentially placing all of your page output into the $galerie variable/template and then passing it to outputpage for final output.

I hope that makes enough sense. Smile
It makes sence Smile. My only problem is, that between galerie_top and galerie_bottom I am using a normal php script. I just wanted to have the MyBB Header and Footer sourounding it. With your solution there would be no space for that. And I think I read before, that putting PHP in the SQL DB is a bad idea and will not work Sad

I also though about using that method to easy integrate an already excisting page (Where I am basically using the same method, having one top and one bottom and just change the contect via include).