Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Documentation on how to convert Smarty .tpl to PHP?
pixuk
New
Hi All,
I'm new to Vanilla and the Smarty templating system, but need to change my theme's default.master.tpl to default.master.php in order to fully integrate the forum with the rest of the site.
Is there any documentation on how to replace things like {asset name="Head"} and {$BodyID} with PHP scripts? I'm assuming 'asset' is probably pulling a file in from somewhere(?) and $BodyID is a variable that can be grabbed from an object(?). All guesswork for me at the moment, so having some reference docs would be useful.
Thanks in advance.
Pete
Tagged:
0
Comments
The best thing to to do is to copy default.master.php to you theme from dashboard/views. Some things are done in the smarty version, as the smarty version need to implement some special fucntion for the abstraction.
You can alternatively stick with smarty, but implement custom smarty functions in a themehook file to add any functionality that you wouldn't be able to do in this smarty implementation out of the box.
grep is your friend.
Smarty actually caches a semi "compiled" version of the master, in php.
Btw its
echo $BodyIdentifier;
for{$BodyID}
grep is your friend.
Yup, I spotted the cached version and though, ooo… that's code I can work with. But sadly the page doesn't render if I just use that code. Doesn't look like the constants are getting defined, so there's probably a Smarty config file that I need to also include.
Huh like I said there is a php version in the core an several themes use it. I would try reconfigure smart, instead add smarty functions where you need them.
grep is your friend.
Thanks. Appear to got over the hump of understanding most of Smarty's templating syntax. Everything works, except going into a discussion I get the following error:
Fatal Error in DiscussionController.__get();
DiscussionController->_tpl_vars not found.
Which I guess means I've missed something out on the template which is only important when trying to view posts. Any clues?