2008-05-05, 08:50 AM
Pages: 1 2
2008-05-05, 12:47 PM
Use Smarty or write your own template parser.
Edit: Or do you require help with regex / algorithms to do that replacement?
Edit: Or do you require help with regex / algorithms to do that replacement?
2008-05-05, 09:32 PM
Asad_Niazi Wrote:Edit: Or do you require help with regex / algorithms to do that replacement?That one. Like how in mybb you add {toplinks} into the template.
2008-05-05, 09:54 PM
You could add the variable on your global.php file. Example,
Go to the end of Global.php and add this:
$message = "Hello World!";
Then add {$message) in any of your templates, and you will see "Hello World!"
Go to the end of Global.php and add this:
$message = "Hello World!";
Then add {$message) in any of your templates, and you will see "Hello World!"
2008-05-05, 10:00 PM
Ok, so if i have an index.php and it says $content = "whatever" and then the page includes the template.html file and within the template.html file it says {$content} that will work?
2008-05-05, 10:18 PM
Wheel-World Wrote:Ok, so if i have an index.php and it says $content = "whatever" and then the page includes the template.html file and within the template.html file it says {$content} that will work?
Nope. You can always add this to your .htaccess file to get php to be parsed in html files:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
2008-05-06, 05:49 AM
How does mybb do it?
2008-05-06, 09:03 PM
Wheel-World Wrote:Ok, so if i have an index.php and it says $content = "whatever" and then the page includes the template.html file and within the template.html file it says {$content} that will work?
No, you put it in global.php. At the end of the file, assign your code to a variable, and then on any template you can add it by putting the name of the variable in between {}
2008-05-07, 09:24 AM
DCR Wrote:No, you put it in global.php. At the end of the file, assign your code to a variable, and then on any template you can add it by putting the name of the variable in between {}I am not talking about within mybb, i am saying how do you do it for other projects.
2008-05-08, 09:57 PM
I thought some staff member would answer this question, oh well.
MyBB stores the templates in the database so it uses something to cover up the real php variables like the {$blah}. The MyBB template system is complex but you can do something similar using the Smarty template system or using eval(), what MyBB uses.
MyBB stores the templates in the database so it uses something to cover up the real php variables like the {$blah}. The MyBB template system is complex but you can do something similar using the Smarty template system or using eval(), what MyBB uses.
Pages: 1 2