ThemeForest

Creating an HTML-Friendly Template System using PH

407 posts
  • Has been a member for 3-4 years
  • Envato Staff
  • Forum Moderator
  • Australia
envato says

Click here to see full post: http://blog.themeforest.net/tutorials/creating-an-html-friendly-template-system-using-phps-output-buffering/

Posted 2 years ago Permalink
envato is an Envato staff member
961 posts
  • Has been a member for 3-4 years
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 1 and 9 users
jeffeatworld says

Nice tut – graphics do a sweet job tooo well done.

Posted 2 years ago Permalink
DevelopmentOcean

DevelopmentOcean Recent Posts
Threads Started

6 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Beta Tester
  • Sold between 100 and 1 000 dollars
  • Bought between 1 and 9 items
  • United States
DevelopmentOcean says

Nice tut! but personally I would do:

public function __construct( $name ) { $this->path = sprintf( '%s/%s.php', self::DIRECTORY, $name ); }

so that I can call the template class like:

$template = new Template( 'page' );

Just my preference.

~Adam Smith

Posted 2 years ago Permalink
2 posts
  • Has been a member for 3-4 years
JGarrido says

Good concept, and it seems like a good tutorial, although I haven’t tried implementing it yet.

I did notice this typo:
a bit hard to understand what’s going on here. B

At the end of this tutorial I want to list some

ut if you follow the order of method calls carefully you’ll get it.

BTW , any chance you can provide the files in a zip file for quick review?

Posted 2 years ago Permalink
1 post
  • Has been a member for 2-3 years
  • Bought between 1 and 9 items
smurkas says

Umm you can actually already do what you propose in Smarty. Smarty doesn’t force you to include three separate files as header-content-footer, you can do the master template with one or more content areas instead if you want.

To use master template pattern you simply write {include file=”$tplName.tpl”} or whatever you want to call your file variable in the place that you want it included. Just set this variable to the content template you want to load and you’re done. In fact this is the basic example in Smartys tutorials which is where I got it from.

I think the header-content-footer pattern simply has been the most popular pattern for some time until people realised how much this sucked on sites with alot of markup.

Posted 2 years ago Permalink
by
by
by
by
by