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_J Admin
I did not say "no Smarty" I've said "nearly no Smarty"
If you look at the default.master.tpl you see only a few Smarty functions in there. Stick to them! You have four main areas (Assets). The contents of them are filled with php, so you just have to do the layout around those blocks: Content, Panel and Foot (forget about Asset Head when you thinking in layout terms since it is the html head element).
So if you decided you like to have a classical layout like that:
Header
Panel|Content
Footer
you can achieve the Panel/Content+Footer part with simply embedding the Smarty Asset functions in divs that you style appropriate.
You'll have to build the header by yourself. See what Smarty functions are there to help you build a menu. Look at /library/vendors/SmartyPlugins to see what "elements" you can use to build up your header. If you need other parts, you can write a custom function for that on your own. If you need to search the forum for "custom smarty". Think of it like Lego bricks. Stick together a rough shape of your forum and polish it afterwards.
In order to polish it, you'll need CSS. If you like to add content to e.g. discussion views, you'll need hooks.
5
Answers
There's nearly no need for Smarty if you like to customize Vanilla
Look here for some resources: http://vanillawiki.homebrewforums.net/index.php/Main_Page
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 http://vanillaforums.org/profile/58951/pavsid&DeliveryMethod=JSON&DeliveryType=VIEW and get that pages content from within your code.
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
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 http://vanillaforums.org/categories/feedback 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).
I did not say "no Smarty" I've said "nearly no Smarty"
If you look at the default.master.tpl you see only a few Smarty functions in there. Stick to them! You have four main areas (Assets). The contents of them are filled with php, so you just have to do the layout around those blocks: Content, Panel and Foot (forget about Asset Head when you thinking in layout terms since it is the html head element).
So if you decided you like to have a classical layout like that:
Header
Panel|Content
Footer
you can achieve the Panel/Content+Footer part with simply embedding the Smarty Asset functions in divs that you style appropriate.
You'll have to build the header by yourself. See what Smarty functions are there to help you build a menu. Look at /library/vendors/SmartyPlugins to see what "elements" you can use to build up your header. If you need other parts, you can write a custom function for that on your own. If you need to search the forum for "custom smarty". Think of it like Lego bricks. Stick together a rough shape of your forum and polish it afterwards.
In order to polish it, you'll need CSS. If you like to add content to e.g. discussion views, you'll need hooks.
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.