Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Template engine for Vanilla

What do you guys think of a template engine for vanilla. There are generic engines like smarty and specific ones like phptemplate of drupal. Since all the functions are already written it wouldn't be hard to wrap around a template engine. It will make things real easy for new users. Personally i love phptemplate engine of drupal. its simple and very fast.

Comments

  • edited October 2006
    I already have a template engine for Vanilla :) But never finished it though, only the core compenents...

    I'll upload it tomorrow and I'll start working on the other files :)

    It's based on MiniTemplator
  • I think a template engine is the biggest missing component from Vanilla's core. Vanilla's use of clean HTML and CSS makes it super easy to theme IF you can accomplish your look just be changing CSS. On the other hand, if you actually need to change HTML around (to take advantage of existing CSS style rules, to conform to existing CSS rules that need certain source order) it' much harder due to the intermixed PHP and HTML code.

    Several thoughts:
    • MiniTemplator looks like it would be a good start.
    • I'm not sure whether the MiniTemplator/Smarty approach (i.e. ${} type variables) or the WordPress/Moveable Type approach (use of <> delimited "template tags") is easier to use.
    • Jazzman's post gives me hope, but how easy/hard would it be for the community to put together a templating system? Could we take advantage of Vanilla's extension points to create a sort of template add-on? Or would this be something that Mark would need to add into Vanilla's core?
    • Jazzman, is your template project something that others could assist with? If it was in a publicly-accessible version control repo, I'd be willing to beta test, submit patches, etc.
  • so has everyone missed the existence of the ability to theme vanilla. I've changed loads of html in vanilla, took me all of 30minutes to make 20 changes.
  • I think the problem that some people have is that the html and the php are mixed in the themes adrian. So people who are scared of php dont want to touch the themes incase they break something.
  • I used smarty and loved it. Thought it was awesome. then i used phptemplate and now i won't go back to smarty. phptemplate is soo much easier and small. if you look at the engine itself or at the template files they are very simple. more simple than smarty. I would prefer a custom template engine specific to vanilla just like phptemplate is specific to drupal. It would take less time to make a custom one than integrate smarty. All the code has already been written, just need to seperate stuff and make nice simple functions to call just for record. I don't know php :) I just look at what people have done and tweak it. thats all.
  • Personally, I wouldn't want to learn another templating engine just to change the appearance. Of course, I am comfortable around PHP.

    If this is done, I would want it to be a optional theme.
  • edited October 2006
    Okay, this is what I'm working on (example of the head control):

    The theme directory:


    As you can see, all HTML is stripped from the php file:



    The HTML template is easy to understand and nice and clean:



    Even the HTML output once it's parsed looks nice and structured:



    Ofcourse, the templating system is easier to change, but it will slow your vanilla a bit down as it uses replace-technology which ofcourse is slower than a normal echo :)
  • See, I would love a template engine, because im a designer and Im not good with PHP, thats the one thing thats put me off theming vanilla, If it could be made easier I would love to theme.
  • Just out of interest, if that template system were used to make a theme for vanilla, would it be possible to save the generated output using the standard echo method? i.e. the templator is used to build a theme and then it's 'compiled' (for want of a better word) into a standard vanilla theme which obviously reduces any performance loss? Might be asking a bit too much..
  • as far as i know it has to compile it on runtime. plus i think it can also cache pages so its faster to load and doesn't recompile the template.
  • To answer Adrian and Minisweeper:

    As a developer and designer (i.e. equally comfortable with PHP and HTML) I still prefer templating to echos. The reason is that the code is far more maintainable and readable, especially when dealing with more complicated theming and /or integrating with existing sites. If the PHP and HTML are nicely separated into their files, your text editor/IE can properly syntax highlight both, you don't have to worry about whether you forgot the single quote at the end of the HTML string, etc.

    All in all, it's a number of little things that add up to making the theming process a much more (or less) enjoyable experience.
  • what would be nice is a simple code like
    <?php print $commentform; ?>
    and boom it spits out a comment form
  • Hi!

    I don't think we realy need a template engine, it's fine, like it is with vanilla!

    But I have a very different problem, which maybee can be solved by using an template engine: I've tried to move some parts of a vanilla page around, but got to difficults, because some things are'n defined in all desing-files of vanilla. You can't move the tabs out of the header in an easy way. I had to write a extension for setting some conf-vars for changing the order of some vanilla parts, to remove and add css files and so on...

    Perhabs that can be done in a more easy way? Perhabs with a template engine?

    Bye
    Tiggr
  • edited October 2006
    I think it could certainly be made easier with a template engine. For example, you could have a template tag like so:

    <div id="header"> <vanilla:navtabs sort="alpha"/> </div>
  • jazzman, this looks fantastic.
  • Hi again!

    What's about it, jazzman, anything around, I can test/use in my forum?

    I realy would love to replace my old form (http://www.larp-welt.de/cgi-bin/sporum/index.cgi) with a vanilla based one. Having a template based theming engine would be very nice for it!

    Bye
    Tiggr

    PS: Of course, I would also change the old and ugly style to a new one! ;-)
  • any updates on this?
This discussion has been closed.