Go to Post Engineering fundamentally comes down to problem solving, and if the students can't get excited and inspired by the problem solving process because someone has spoon fed them a solution, then nobody wins. Give a man a fish, he'll eat for a day. Teach a man to fish, he'll eat for a lifetime. - kevinw [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-11-2004, 17:16
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
PHP template engine

I'm looking around for php template engines (IE, Smarty, XTemplate, etc.) to use with our team site.

Which one(s) would you recommend and why?
__________________

  #2   Spotlight this post!  
Unread 25-11-2004, 17:55
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Re: PHP template engine

Quote:
Originally Posted by Ryan Morehart
I'm looking around for php template engines (IE, Smarty, XTemplate, etc.) to use with our team site.

Which one(s) would you recommend and why?
I tried using Smarty, and I couldn't get it to work. Granted, I already had an entire page created, and it was a hack and slash kind of conversion, and I didn't put nearly as much effort into it as I should've. If you take the time to learn it though, Smarty seems to be pretty simple to use.
__________________
AIM --> Woloi
Email --> ian@woloschin.com

Last edited by Ian W. : 25-11-2004 at 17:57. Reason: Firefox + TagAlert leaves cruft in quotes with hyperlinks
  #3   Spotlight this post!  
Unread 25-11-2004, 22:38
HFWang's Avatar
HFWang HFWang is offline
Registered User
AKA: DarkWulf
#0115
Team Role: Webmaster
 
Join Date: Jan 2003
Location: Cupertino
Posts: 177
HFWang will become famous soon enough
Send a message via ICQ to HFWang Send a message via AIM to HFWang
Re: PHP template engine

I've heard good things about patTemplate (http://www.php-tools.de/site.php?fil...e/overview.xml) and SmartTemplate (http://www.smartphp.net/content/smar...out/about.html)... my experience with them is limited, but I liked how "lightweight" they felt.

There is always the "easy" option of just plain PHP. TBH, 99% of the time, auto_prepend, auto_append, and a normal PHP page will do the job just as well, all without having to learn a new language. When you pick up a template package, like it or not, you are usually learning a new programming language, and I have always felt that this is simply overkill. PHP is a fine templating language, it comes with blocks, if/else structures, and everything else you could possibly need. And don't tell me that <!-- IF var -->....<!-- ENDIF --> is somehow simpler than <?php if ($var) { ?> <?php } ?>, they're essentially the same thing in the end. Skip the process of converting templates into PHP programatically and just write PHP from the start. :-/
__________________
rawr
  #4   Spotlight this post!  
Unread 26-11-2004, 00:04
Joel J's Avatar
Joel J Joel J is offline
do you..
no team
 
Join Date: May 2001
Rookie Year: 2000
Location: San Jose, CA
Posts: 1,445
Joel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond repute
Re: PHP template engine

I remember looking into this a while back. I believe I came to the conclusion that Smarty had the best concept of what a template engine should be. That is, not simply an engine for replacing placeholders with relevant content, but an engine that facilitates the separation of application logic (getting the last 10 posters in this forum from the database) from presentation logic (increasing the size of a posters name if they are a moderator). However, Smarty is a feature rich template engine. So much so that it is becoming a programming language all of its own. This reality causes many programmers to cry down the use of Smarty, because they think it has lost sight of what a template engine should be. I have to admit, I took this position for a while, but as I thought about it more I realized that if a designer chose to limit himself (herself?) to the core elements of Smarty, then the overdone nature of Smarty becomes irrelevant. Added to that, the designer still benefits from some of the nicer features of Smarty (caching, etc..) that are not present in other template engines.

So I guess I'd recommend a controlled use of Smarty: use the elements you need, and ignore those that are unnecessary, or that will cause a deviation from the true purpose of a template engine.

PS: I ended up just writing my own template engine. Smarty was an excellent engine, but it lacked a few features that I really wanted to have (storing and retrieving templates from a database, etc..). Smarty was designed in a way that allows its users to add custom functions, so I could've integrated the missing features that way, but you know.. lazy.

edit:

Something along the lines of:
Code:
<html>
<head>
  <title><var name="title"></title>
</head>
<body>
  <h1><var name="forumname"></h1>	
  Last 10 posts:
  <ul>
    <repeater name="posts">
      <li><var name="posts.title"> (in <var name="posts.parentthread">) <br /> <var name="posts.author"></li>
    </repeater>
  </ul>
</body>
</html>
is easier for a website designer to look at and grasp than:
PHP Code:
<html>
<head>
  <title><?php echo $title ?></title>
</head>
<body>
  <h1><?php echo $forumname ?></h1>    
  Last 10 posts:
  <ul>
    <?php foreach ($posts as $post): ?>
      <li><?php echo $post['title'?> (in <?php echo $post['parentthread'?>) <br /> <?php echo $post['author'?></li>
    <?php endforeach; ?>
  </ul>
</body>
</html>
Why? Because web designers often know nothing beyond HTML/CSS. In addition, HTML is more like a structure providing language than an actual "programming" language, so the ability to understand, edit, and create HTML pages does not imply the ability to pick up on programming languages (even PHP, as simple as it is). Therefore, the template engine, should it want to be friendly to its user, should make its format resemble HTML as much as possible. My goodness, do you remember when you first had to grasp the concept of accessing elements of an array using square braces? Better yet, having to explain, in an understandable way, what square braces after a variable name does? Presentation does make a difference.

Smarty's tags resemble PHP rather than HTML, and it does make it somewhat harder to learn (or explain to someone). But for this second response, I'm not talking about Smarty, but template engines in general.

PPS: I know PHP, but I would personally rather deal with the HTML-like template tags when designing pages. It may just have to do with my mindset.
__________________
Joel Johnson

Division By Zero (229) Alumni, 2003-2007
RAGE (173) Alumni, 1999-2003

Last edited by Joel J : 26-11-2004 at 01:41.
  #5   Spotlight this post!  
Unread 26-11-2004, 18:22
evulish's Avatar
evulish evulish is offline
1010100
AKA: Grant Harding
#0084 (WATTNESS (bot: Chuck))
Team Role: Alumni
 
Join Date: Jul 2002
Location: Towanda/Wysox, PA
Posts: 1,434
evulish is just really niceevulish is just really niceevulish is just really niceevulish is just really nice
Send a message via AIM to evulish
Re: PHP template engine

If you're looking for a very basic templating system, they're pretty simple to write. The one I wrote is about 30 lines of code. You basically load all your data you want to put into the template into an array, then load your template, and search and replace. I've never used one of the already-made ones but I hear a lot of talk about Smarty. Like Joel said, it's great if you keep it simple.
__________________
I'm a professional web developer. I'm good with PHP, Perl, Java/JSP, some RoR, XML, Javascript (AJAX as well), (x)HTML, CSS, etc.. Validated code is good; fully cross-browser code is better (you comply to your users and the software they use, not the other way around. Sorry!)
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Speaking of PHP 5... Ryan M. IT / Communications 3 01-08-2004 16:46
openFIRST PHP 5 Compatibility Timothy D. Ginn FIRST-related Organizations 0 30-07-2004 13:45
PHP and Wiki Error Venkatesh Website Design/Showcase 2 24-07-2004 15:51
php vs. perl Jack Website Design/Showcase 20 29-12-2002 17:01
What's better, PERL/cgi or PHP/my_sql? mikefrei Programming 10 27-05-2002 22:50


All times are GMT -5. The time now is 15:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi