Print custom templates.
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #1
Print custom templates.
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.


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 10-19-2011 06:21 AM by Sama34.)
10-19-2011 06:17 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #2
RE: Print custom templates.
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()?

10-19-2011 06:56 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #3
RE: Print custom templates.
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.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
10-19-2011 07:48 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: Print custom templates.
Just copy what MyBB does, which is essentially eval the result of fetching a template, and then sending the whole page to output_page().

My Blog
10-19-2011 08:55 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #5
RE: Print custom templates.
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:
1
2
3
4
5
6
7
8
9
<?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


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 10-23-2011 03:06 PM by Sama34.)
10-23-2011 03:04 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: Print custom templates.
Then copy a full template such as showthread and paste it after the ?>, and work from that.

My Blog
10-23-2011 03:47 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #7
RE: Print custom templates.
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

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
10-23-2011 08:28 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: