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.

Figured out how to customize header and footer!

I've spent the past 72 hours searching and reading everything on customizing. Downloaded other themes to reverse engineer but nothing was helpful.

I've found the solution.
http://robotgrrl.com/blog/tag/vanilla/

When creating the RoboBrrd forums a few days ago, I wanted the theme to have the same header and footer as the rest of the site. The way the site is ‘designed’ is that the header and footer can be included via a php include. This is in order for the main website to be run from a Twitter Bootstrap framework, the blog from WordPress, and the forum from Vanilla. Switching between these should not be interruptive to the visitor.

Vanilla themes are different though. They use a .tpl file, which is as it sounds, a template file. Smarty, which is the template engine is able to parse through this, and perform its template magic.

There are two ways that php includes could be done, however do not work with Vanilla. These are:

{literal} your literal content here {/literal}
{php} your php code here {/php}
The literal tag way does not work. Not quite sure why, but I spent the time with it and it doesn’t work.

The php tag way does not work because the php tag in Smarty was deprecated.

Instead, the best way to do this is with a custom function! This way works, and it is quite fun.

Here is how to do it:

Navigate to /vanilla/plugins – where ‘vanilla’ is whatever folder name your forum install is in
Create a new file named: function.myinclude.php
Add in this php code below, where the include path is whatever path to the php file you want to include (such as header.php or footer.php)
<?php function smarty_function_myinclude($params, $smarty) { include("path.php"); } ?>
Save it. Now navigate to your .tpl file for your theme. Example: /vanilla/themes/BrandFriendly/views/default.master.tpl
Wherever you want your php include to be, add this line to your tpl file:
{myinclude}
Save it and test it. It worked for me, so hopefully it works for you too!
Those steps are all that is needed to get your lovely headers and footers added in. To create multiple of these plugins, be sure to rename the filename as well as the function name, and the tag name as well. For example, we used the name ‘myinclude’, and if you wanted you could create a different one like ‘leadsolder’, by renaming the places where it says ‘myinclude’, in the file name, function name, and tag in the tpl file.

Well, I hope this will help someone on the internet somewhere! It took a while for me to figure out.out.I've spent the past 72 hours searching and reading everything on customizing. Downloaded other themes to reverse engineer but nothing was helpful.

>

Sign In or Register to comment.