UseBB Community

The official board for UseBB help and discussion

UseBB Community » 2.x Discussion » Another template engine suggestion

Another template engine suggestion

Page: 1

Author Post
Member
Registered: Aug 2006
Posts: 43
Location: The Netherlands
Hi all,
I've been using UseBB for a little while now, and also found that UseBB 2 is going to be developed. There have already been a few template engine suggestions, so I'll just add my favorite one here, TinyButStrong.
In the beginning it'll be a bit hard to understand but it's a really powerfull class to work with and also easier to understand after a while. Here is an example of the code for the CMS I'm writing using it, wich may eventually be integrated with UseBB 2 once it is released.
Index.php:
<?php
include_once('config.php');
include_once('./scripts/tbs_class.php');
$tmpl = new clsTinyButStrong;
$tmpl->LoadTemplate('template/home.html');

$data1 = $tmpl->MergeBlock('latest','mysql',"SELECT * FROM `articles` WHERE published = 1 ORDER BY id DESC LIMIT 0,5");
$data2 = $tmpl->MergeBlock('cats','mysql', "SELECT * FROM categories WHERE published = 'YES' ORDER BY id");
$data3 = $tmpl->MergeBlock('article', 'mysql', "SELECT * FROM articles WHERE published = 1 WHERE seftitle = ".$_GET['title']." ORDER BY id DESC");
$data4 = $tmpl->MergeBlock('files','mysql',"SELECT * FROM `files` ORDER BY id DESC LIMIT 0,5");
$tmpl->Show() ;
?>

Home.html
			[onload;file=template/overall_header.html]
<div>
<h2><a href="news.php?mode=article&amp;artid=[latest.id;]" class="news">[latest.title;htmlconv=no;]</a></h2>
[latest.text;htmlconv=no;block=div]
<div class="newsline">Posted on [latest.date]</div>
</div>

[onload;file=template/overall_footer.html]

It can handle more than one SQL DB system, like SQLite, MySQL and more wich can be added with plugins.
At least consider and try it, and good luck with developing! :)
Martijn
Developer
Registered: Apr 2004
Posts: 2180
Location: Belgium
It seems like a nice system, though as we are currently using a 3rd party (BSD licensed) database layer and objects to represent each node in UseBB 2, it isn't possible to use this kind of templating using SQL queries.

As for the template engine, we have chosen to use Savant by default but allow other engines to be used (however this one will probably not work because of the reasons given).
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Aug 2006
Posts: 43
Location: The Netherlands
I get your point, and I've also came across a limitation off the system long ago already, you can't use the class to execute UPDATE or INSERT INTO queries, only SELECT queries are supported as far as I can tell. This would mean you'd need yet another DB class to handle the other functions.
Quote
it isn't possible to use this kind of templating using SQL queries.


This is a little unclear to me though, what do you mean with that?

Anyway, it's your personal choice if you want to use Savant for the templating ;)
And a side-question: you said the 3rd party DB layer is BSD licensed, but doesn't the forum license conflict with that when it's released? GPL and BSD are quite different IIRC...
Developer
Registered: Apr 2004
Posts: 2180
Location: Belgium
I mean we are using an OO system where every node is represented by a class, that class performs all the database operations. This template layer does the database layer on itself. You can't use both systems. Apart from this, I suspect it wouldn't be easy at all to do processing in the controller part (MVC) while this template systems doesn't seem to allow any processing next to the template itself.

Quote
Doesn't the forum license conflict with that when it's released? GPL and BSD are quite different IIRC...

The "New BSD license" should be compatible with the GPL.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Aug 2006
Posts: 43
Location: The Netherlands
I get it now :)
Thanks for taking the time to explain.

Page: 1

UseBB Community » 2.x Discussion » Another template engine suggestion

UseBB Community is powered by UseBB 1 Forum Software