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.

Creating Custom Theme

Hi all, I'm integrating Vanilla into our existing website, and so need to in effect create a custom theme which matches that of the existing site.

I understand that most of this might be more to do with Smarty, than Vanilla, but I'll ask anyway as maybe they are linked in ways I don't know about yet..

1) In the default.master.tpl there are references to "assets" e.g. {asset name="Foot"} - where can I find and edit the HTML which is generated here?
2) How can I render templates from the existing site, and will any PHP within them be parsed (they are PHTML files)?
3) How do I render some content which is pulled from the existing site using PHP? Is this where template hooks come in? Any tutorials anywhere?

Sorry if these have been asked before, I couldn't find anything in the documentation or on this forum.

Many thanks

Best Answer


  • R_JR_J Ex-Fanboy Munich Admin

    There's nearly no need for Smarty if you like to customize Vanilla ;)
    Look here for some resources:

    You are right about your theme hooks assumption: in order to add content to a page you'll most probably need to hook into some FireEvent() call.
    Try to find the file that outputs the html around it with a fulltext search capable editor (you'll get used to Vanillas file structure and be able to locate the files you need later on simply by looking at their "purpose") and watch out for calls to the function FireEvent(). That's where you can get influence on the code.

    If in doubt, simply ask "I want to add this to that" or draw a nice picture of what you are trying to achieve and you will get help here.

    Rendering a page from Vanilla on other pages can often be done by adding some parameters to the url like that and get that pages content from within your code.

  • @R_J said:
    There's nearly no need for Smarty if you like to customize Vanilla ;)

    Oh good! I don't wanna have to learn Smarty - decided I wasn't going to get into that a looong time ago!

    Can you point me in the right direction for rendering something like the "Panel" without using Smarty then please? Just to get me going on the right path.

    Thank you

  • R_JR_J Ex-Fanboy Munich Admin

    I cannot imagine a use case for "just the panel". It is not answerable by the way. What is displayed in the panel is related to the page it is displayed. If you look at you'll see that in the panel the category Feedback is highlighted. If you are logged in you see the me box, otherwise the "Howdy Stranger" message.

    What is it you like to achieve? Do you want to show you own page "inside" a Vanilla page? You might be interested in the Articles Addon. Or, if it is a one pager, ExtraPages.

  • Ah right ok. Well, I am starting with the default.master view, but as it is currently is a Smarty template (tpl) it simply contains {asset name="Panel"} inside it.

    So I am wondering how to render this from within the default.master.php file (i'm trying to avoid using Smarty like you suggested).

  • hgtonighthgtonight ∞ · New Moderator

    I want to add to @R_J's excellent post that you must render the Foot asset.

    Not doing so will prevent your forum from working properly.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.