Re: [UseBB-Development] Template engine
Light and Free PHP Forum Software
Brought to you by:
pc_freak
From: Joren de G. <jor...@gm...> - 2007-03-25 14:18:31
|
I think this <http://www.tinybutstrong.com/article_3rd_kind.html> may explain better then what I've written below. 2007/3/25, Joren de Graaf <jor...@gm...>: > > Hi Dietrich, > I'm not sure how to reply to this message (doing it from Gmail). > But I've suggested the use of the TinyButStrong<http://www.tinybutstrong.com/>template engine before on the UseBB forums. > > At a first look this engine may seem very different and difficult but it > does in fact perform the same way of processing like Smarty does, only the > big differences between the two are that: > Smarty code is something like this: > {foreach $posts as $post} > <h2>{$post->title}</h2> <p>{$post->content}</p> > {/foreach} > {if $user->loggedIn} > <p>Welcome back {$user->name}!</p> > {else} > <p>Hello, please <a href="{... code to show register link > ...}">register</a>!</p> > {endif} > (posted in another message of this mailing list.) > ----------------- > TinyButStrong code looks like this (from my personal portal that > interfaces with UseBB 1): > <div class="menucnt"> > <h3 class="wimg">[flang.UserPane]</h3> > [onload_sess.level;block=div;when [var.sess.level] =0] > <p style="font-size: 11pt;padding-left: 2px;"> > Welcome, [flang.Guest]!<br/> > Please <a href="[var..cst.ROOT_PATH]panel- login.html">login</a> > or <a href="[var..cst.ROOT_PATH]panel-register.html">register</a>. > </p> > </div> > <div class="menucnt"> > <h3 class="wimg">[flang.UserPane]</h3> > [onload_sess.level;block=div;when [var.sess.level] > 0 & < > 3] > <p style="font-size: 11pt;padding-left: 2px;margin-right: > -2px"> > Welcome back, [var.sess.displayed_name]!<br/> > </p> > <ul> > <li><a href="[var..cst.ROOT_PATH]panel-logout.html ">[ > flang.SiteLogOut]</a></li> > </ul> > </div> > <div class="menucnt"> > <h3 class="wimg">[flang.UserPane ]</h3> > [onload_sess.level;block=div;when [var.sess.level] = 3] > <p style="font-size: 11pt;padding-left: 2px;"> > Welcome back, [var.sess.displayed_name ]!<br/> > <span style="font-size: 10pt">Your last visit was on: > <i>[var.sess.last_login;frm='dd mmmm yyyy']</i></span> > </p> > <ul> > <li><a href="[var..cst.ROOT_PATH]panel-logout.html">[ > flang.SiteLogOut]</a></li> > <li><a href="admin.php ">[flang.SiteAdminPane > ]</a></li> > </ul> > > </div> > --------- > > What the code above basically does is checking which user level the > current user has (0-3: guest - admin) and displays the corresponding block, > not parsing the other blocks. The {foreach} statement from Smarty is > achieved by TBS by simply reading the 'block=' argument from the code. > > This alows for much cleaner and smaller code to be written that does the > same thing the Smarty code does. Also, this code is much easier to be read > by users who don't know PHP. In adition to that, the code can also be viewed > in virtually any WYSIWYG editor. > > I think that this solution is deffinately worth looking at. > Good luck, > Martijn (martijn at UseBB forums) > > 2007/3/24, Dietrich Moerman < die...@us...>: > > > > Melissa schreef: > > > I have never heard of XSLT; I'll have to take a look at it. > > > > XSLT is a system based on XML and XSL. The data passed to the template > > is XML data and XSL code inside HTML is used to place the data in place. > > This is the same as the push principle I explained before with a > > template syntax that is somewhat standardised (XSL is a W3C > > recommendation). However this requires PHP to have a XSLT parser enabled > > all the time, and probably a whole bunch of extra processing time. > > > > -- > > Dietrich -- http://dmoerman.be > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net 's Techsay panel and you'll get the chance to share > > your > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > UseBB-Development mailing list > > https://lists.sourceforge.net/lists/listinfo/usebb-development > > > > Unsubscribe quickly? Send "unsubscribe" > > to use...@li... > > > > > > -- > Google Gmail - www.gmail.com -- Google Gmail - www.gmail.com |