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.
Include PHP in default.master.pl
marconyfelipe
New
Hello friends!
I'm developing a Vanilla Forum and I am very happy with the result. But, how can I include a top, that is in php file, in my header?
I tried (file: default.master.pl):
{php}
include('../top.php');
{/php}
Reference: http://www.smarty.net/docsv2/en/language.function.php.tpl
Sorry for my bad English!
Thanks in advance! :-)
1
Comments
You can't include php while your theme is based on tpl inside the default.master.tpl
What theme do you use ? Try a php based theme to be able to add more php
otherwise try to get familiar with Smarty http://www.smarty.net
Please provide the Vanilla version number you are using.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Ok vrijvlinder.
I am use Ozone Theme. Look: http://themeforest.net/item/ozone-premium-vanilla-2-theme/796129
And Vanilla Forum 2.1
Can you help me?
Can you elaborate on what it is that you wish to add to the master?
You can use standard html in the default.master.tpl
Ok I think I understand , you wish to add a php file to be called from the tpl ?
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Ok I get it. I have a site with several functions, one of which is the forum. To avoid losing the "pattern", only wanted to add the "top" (PHP+HTML+CSS) of the website Forum.
But if there is no other way, I will add the same common HTML.
Thank you!
You can use a default.master.php file instead of a .tpl file. This will allow PHP, but it will mean you can't use any Smarty at all. It makes Vanilla theming a bit rougher. Personally, I'd just include the common HTML rather than converting to a PHP template.
This means the style ?
You can replicate the style to match, either use some html combination with css .
You are very Welcome
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Thanks Licoln and vrijvlinder!
I ended up writing wrong (To avoid losing the "pattern" - not to lose formatting). haha
Lincoln, How can I only use PHP?
Thanks!
You would need to use a php based theme one that use default.master.php I personally like that more than Smarty .
Maybe your theme can be converted or you can try a php based theme here in the addons and see how it's built and replicate it.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Ok ok vrijvlinder! Thanks a lot!
Have a good night!!! :-)
In a themhook file you can also make and register a smarty function to the framework. Then use it to include a file and return the result.
grep is your friend.