mark, i know you're working on the latest version with a revised template system. is there anyway you could quickly describe the changes you made to make the forum easier to style? i'm very curious about that o8 screenshot you keep posting and just how much easier it actually will be to stylize vanilla.
Here's how the folder structure is set up currently:
So, there is a base folder that holds all themes. You can create a new theme by just copying the default vanilla theme and then altering all of the files within. As you can see, right now in the templates folder there are only five template files that I've created. I've still got to go make a few other ones - eventually it will hold all template files for all pages.
Those template files contain all xhtml in vanilla, so you can change it completely. I haven't dumbed it down at all - there is php code in those template files, too. So if you were a smartypants, you could pretty much do whatever you wanted in there.
The next thing to wrap your head around is how themes are applied. A forum will only ever have a single theme applied to it. So, on this forum you couldn't have one person seeing that o8-style theme and another person looking at this current default vanilla theme. There are various reasons for that, the biggest one being that if a theme intrinsically changes the way the forum functions, then one person might be able to do something in theme A that theme B never intended that person to do.
But there is still custom styling on each theme - which is why each theme (as you can see in the image) has a "styles" folder. The idea there is that once you've defined the xhtml how you want it, you can still apply multiple styles to it and allow your users to switch between those. So in the future we'll have new themes coming out and available to vanilla administrators - and then we'll have new styles coming out for particular themes, and those styles are available directly to the forum users.
Wait, so in the next rev people wont be able to run different themes on the same forum? What are the chances of the forum admin being able to choose between running a theme system OR the existing style system? Pretty much zero i assume? Minisweeper watches marks head explode.
I think he's saying that in the next revision the entire theming system will sort of step back one pace. At the current, the html is embedded within the PHP, and you can style it differently with CSS but can't actually change the html without a whole lot of difficulty. With the new system, each theme will contain the html, and within each theme users can run different styles. As the themes, containing the html, will have a large effect upon how users interact with the forum, there can only be one theme running at a time, but within that theme different users can style it with CSS how they like.
Not sure if that's entirely accurate, just my impression.
Wait, so in the next rev people wont be able to run different themes on the same forum?
That is correct, but they *can* apply different styles to the current theme.
What are the chances of the forum admin being able to choose between running a theme system OR the existing style system? Pretty much zero i assume?
Well, it's open source, so you can do whatever you want. Originally that was what I wanted to do, but as I mucked about in the xhtml on my first test theme I realized that looking at the site in two different themes posed a myriad of potential problems, so I pulled back on the reigns.
"I realized that looking at the site in two different themes posed a myriad of potential problems" - well to my thoughts, you wouldnt have to use 2 different themes, what i was suggesting was that people could choose between how the style system runs now, and how it's going to run soon. But that's because i misread that the users would infact stil have control over the stylesheet they were using, in which case my theory is pointless.
The php files in the root folder (current version) seem basically to be bare wrappers around controls that do the actual page rendering; is this true of the template files in the new version?
This could prove to be an annoyance in some cases. If you made a style that relied on a certain theme, your audience can only use it if they scrap what theme and styles they already have and use yours instead.
yeah ben - thats partly what i was considering when i was startled at first that people wouldnt be able to swop styles as they can at present. I suppose it depends how many people go to the extra effort of making an entire theme - i presume that there will be considerably more styles than themes.
I haven't yet written a theme switching control. But when I do it will have two selectors on it - the first will contain the theme selection, and the second will contain a "default style" selection. So if you create a new theme and create three styles for it, you can select your theme in the first dropdown, and then choose which style you want to default users to in the second selector.
However, this will be an extension since I expect that for the most part an administrator will create a theme when starting his/her forum and then only very rarely re-template their forum.
Theming will be a part of the core. Granted, you can just stick with the default theme if you want.
There was no way to make theming (or templating or whatever you want to call it) an extension because it required restructuring the vanilla folders and ripping code out of core controls.
i am very very excited for this. the only thing i didnt like about vanilla was the lacking of ability to switch around some html elements, but now thats solved. bravo mark!
Mark: wow. smarty is cool - and it's exactly what I was planning for templates in the next rev of vanilla
Seems like Mark was interested. Personally I think Smarty will be too big. It's a complete other system. I checked out Savant which is cleaner and very good commented. It's just a class with plugins and it doesn't have a new template coding markup language, it just uses php. The main function of Savant is to seperate layout from content.
Personally I don't think any of all these is necessary. WP has some great themes though it uses plain php in it. Maybe it is easier for most people. But is there so much difference between {post_date} and <?php post_date(); ?> ? Is there actually much performance lost when using smarty? Since it seems quite common probably not, but maybe someone has some experience with this.
Well.. most templating systems attempt to seperate code from layout... But I don't think you should go for that. I agree with jos that {post_date} is not much different from <?php post_date(); ?>.... Template system shoulds seperate content from layout. Content is variable, layout isn't. Therefor I like WP's theming system. Just some core php functions that do the trick.
Personally, I preffer something that uses a super simple render call, as opposed to having to stick opening and closing php tags all over the damn place. In the long run you're not left looking for that one unclosed tag and scratching your head at why half the page renders and half dumps your code onto the screen.
that comment of mine was way back in August. Feels like a lifetime ago. There's no smarty in the next rev of Vanilla. I decided to keep it simple. You'll see soon.
Hi, I'm new to Vanilla and love the way it works, congratulations Mark.
I am currently using 0.92 and wanted to know how easy will the upgrade be for the next version, I'm really interested in the new templating features but I would like to start inviting people to my new forum and be able to jump to the next version without much downtime.
Eventually when everyone agrees that 0.9.3 is ready for public release, I will sit down and write an upgrade script. So the transfer won't take more than a few minutes (unless you encounter some kind of unforseen problem, of course).
Put it this way, i grabbed the latest copy of 0.9.3 and switched my forum over in (not that i was counting) probably under 5 minutes. Couple of issues here and there but thats because it really is a beta. If you waited for the real release with the install (and presumably upgrade, mark?) scripts, I'd like to lay myself on the line and guess you could upgrade in a minute. If you did it now, then yeah, i'd say you were looking at a maximum 10 minute downtime unless something went /really/ wrong.
That's great news!, thanks guys, I will keep this new forum using 0.9.2 for now and learn more about extensions, customizing and getting familiar with the code and when the time comes I will upgrade to 0.9.3
If you're gonna familiarise yourself with the code i'd suggest you grab the latest version from the svn and familiarise yourself with that to save having to relearn stuff. Definately a good idea to keep the live forum on 9.2 for now though :)