MyBB Hacks

Full Version: Print custom templates.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using this at the beginning of my custom php file:

PHP Code:
<?php
chdir('foros'); // path to MyBB
define("IN_MYBB", 1);
require './global.php';
?>


If I write this:

PHP Code:
<?php echo($header) ?>


The header is show correctly, but I want to use custom templates for some reasons, is there a way to call this templates?

I can call templates from Global Templates using the code above, but if the template is under "Ungrouped Templates" group nothing is show.

I have tried this three:

PHP Code:
	<?php echo($GLOBALS['templates']['templatename']) ?>
	<?php echo($GLOBALS['templates']->get('templatename')) ?>
	<?php echo($templates['templatename']) ?>


Can somebody give me a clue or something Erf?

Edit: Or is there a way I can use the <template templatename> line that comes with the Template Conditionals plugin, but of course, outside the forum.

Do you mean that the custom page is outside your forum folder/dir?
Is there any reason why you don't want to use eval()?
Yes, the structure of my page is like this:
htdocs
-/forums/
-/index.php

index.php use the login form for the forum, later I found it very convenient, as I can style inserting the forum header and alike.

But now I want to make it so that I can insert not just mybb default/valid variables, now I want to be able to insert a custom template directly into my index.php file and modify the template from the Mybb ACP.

I don't know that much about php, I will check the eval() funtion.
Just copy what MyBB does, which is essentially eval the result of fetching a template, and then sending the whole page to output_page().
I think I have misunderstood. I have tried a little and I think I explained it wrong :/

I want to write something like this:

PHP Code:
<?php
chdir('foros'); // path to MyBB
define("IN_MYBB", 1);
require './global.php';
?>
{$header}
{$custom_template}
<!--html_content-->
{$footer}


I don't want to manage all the document from the acp template system Erf

Then copy a full template such as showthread and paste it after the ?>, and work from that.
I think I found the solution, I have to use eval() as RateU pointed out, and output_page() as you did Zinga Burga.

Thanks for your help Smile
Reference URL's