Basic question seeks simple answer.
Firefox Wins Offline
Member
***
Posts: 164
Joined: Mar 2008
Post: #1
Basic question seeks simple answer.
This was posted @ MyBB a while back; Someone was trying to show others an easy way to make custom pages.

PHP Code:
1
2
3
4
5
6
7
8
9
10
<?php

define('IN_MYBB', 1); 
require "./global.php"; 

add_breadcrumb("Welcome Page", "welcome.php");

eval("\$welcome = \"".$templates->get("welcome")."\";"); 
output_page($welcome); 
?>


For a quick and easy MyBB Hack / If I use Yumi/Zinga's php in templates plugin, then...
Rule #1 Rules Basic questions should be simple....
...re-writing code...

PHP Code:
1
2
3
4
5
6
7
8
9
10
<?php

define('IN_MYBB', 1); 
require "./global.php"; 

add_breadcrumb("New Index", "./new_idea/index.php");

eval("\$new_index = \"".$templates->get("new_index")."\";"); 
output_page($new_index); 
?>


If I use Yumi/Zinga's php in templates plugin:
The file /new_idea/index.php (and / or the template) could contain the index page of almost any simple GPL script or class from here @phpclasses.org, as long as the other script doesn't have a conflicting login, "headers already sent", or namespace / variable issue?

Asking the same question in one simple sentence:
Learning a template system can be very confusing at first; The above code could be a really easy way to use a variety of php files along with MyBB, correct?
Glad to get some help, thanks for being here.

(This post was last modified: 06-11-2010 01:01 AM by Firefox Wins.)
06-11-2010 12:46 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Basic question seeks simple answer.
You don't have to use MyBB's template system at all actually.

If you're trying to integrate scripts together, it will really depend on what level of integration you want, and how the other scripts function.  For example, if all you want is the MyBB header on the other script, you'll need to somehow pass the $header variable to the other script, depending on how it outputs HTML.
So unfortunately, I can't give you a simple answer to that.

My Blog
06-11-2010 09:46 AM
Find all posts by this user Quote this message in a reply
Firefox Wins Offline
Member
***
Posts: 164
Joined: Mar 2008
Post: #3
RE: Basic question seeks simple answer.
Got it, DIY & experiments are the best way to learn anyway.
You have shared before that php is sometimes slower than template variables, so by now I should stop looking for an easy way to avoid fully understanding the template system,
html here ---> code here (duh)
I'm familiar with several options, often too many options, thanks.
06-11-2010 11:52 AM
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: Basic question seeks simple answer.
PHP in templates is slower, but PHP itself is probably faster than the templates system.  Either case, I don't think it's that much of an issue unless you expect lots and lots of requests that your server has trouble keeping up.

My Blog
06-11-2010 12:26 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: