Using Templating Engine

Express the business side of your digital lives. Share your experiences and/or your comments regarding a business or organization.

No advertising.

Moderator: General Moderators

Post Reply
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Using Templating Engine

Post by Ree »

How many of you use some kind of templating exngine when you are working alone? By saying alone, I mean you recieve graphic design (HTML) from your client (or do it yourself) and code the required. The question applies mainly to freelancers, I guess.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I would like to use a template engine all the time, however, I leave that decision to the client giving them the list of pros and cons.
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

Well, why exatly would you want to use it? Since you're working alone, you can write those presentation-related echo's/if's/loops inside the HTML files without worrying some designer won't understand them.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

So I don't have to come back at some later point to write in a new design, wasting lots of my time and their money.
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

@feyd:

Do you program a custom template engine (in an earlier post you said that you ususally do custom code), or do you use an established template system, such as Smarty or other?
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

i almost always use a template engine, not because of designers, but because i find that it's cleaner
right now, i'm using Smarty with some modifications
Last edited by andre_c on Wed Oct 12, 2005 1:43 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

all custom.. although each is largely similar to the previous one.. but some features and things change between each to suit the client..
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

andre_c wrote:i almost always use a template engine, not because of designers, but because i find that it's cleaner
Well, in what way do you find it cleaner?

Actually when you're alone and you get a develop-and-forget client, I guess there's not much point in writing those custom tags and then do the replacing, as I mentioned, it's faster to write simple php snippets by hand.
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

In my own programming, I don't use a template engine such as Smarty. However, I have customers that run scripts that use Smarty so I know how to use it. I'm not really sure there's any savings in either method ... well except maybe performance. I still get called to install new layouts either way. :?
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

Ree wrote:Well, in what way do you find it cleaner?
i find the tags easier on the eyes than php:

Code: Select all

Name: {$name}
instead of

Code: Select all

Name: <?=$name?>
also there's some useful functionality like {foreachelse} and {cycle}
that look cryptic when done using php, but look very straightforward in smarty

Code: Select all

<table>
  {foreach from=$users item='u'}
    <tr class='{cycle values='odd,even}'><td>{$u}</td></tr>
  {foreachelse}
    <tr><td> -- no users --</td></tr>
  {/foreach}
</table>
plus i added some functionality that i call widgets:

Code: Select all

{widget type='box' label='Content'}
  some content
{/widget}
so i find it clearer, but it may just be preference

... also develop-and-forget type of clients are VERY rare (at least in my experience)
Post Reply