Roll your Own Templating System in PHP: New Premium Tutorial
plus

Roll your Own Templating System in PHP: New Premium Tutorial

Tutorial Details
  • Topic: PHP Templating
  • Difficulty: Advanced
Download Source Files

Push the limits of your PHP knowledge with this extremely in depth and advanced tutorial. You’ll learn how to implement techniques, including object-oriented programming, regular expressions, and function currying to build a templating system from scratch. Become a Premium member to read this tutorial, as well as hundreds of other advanced tutorials and screencasts.

Example of Tut

Join Net Premium

NETTUTS+ Screencasts and Bonus Tutorials

For those unfamiliar, the family of Tuts+ sites runs a premium membership service. For $19 per month, you gain access to exclusive premium tutorials, screencasts, and freebies from Nettuts+, Phototuts+, Psdtuts+, Phototuts+, Aetuts+, Audiotuts+, Vectortuts+, and CgTuts+ For the price of a pizza, you’ll learn from some of the best minds in the business. Become a Premium member to read this tutorial, as well as hundreds of other advanced tutorials and screencasts.

Tags: Premium
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://laroouse.com piyansitll

    bu ne işe yarar durun sakın söylemeyin söyleseniz de türkçe söyleyemezsiniz

    • Purple

      In English, please!

      • http://www.chimply.net Dieter

        We shouldn’t discriminate people based on there geographical location, language, race, gender, … etc.
        I like the fact that’s she’s willing to participate on nettuts even if she doesn’t speak the language.
        At the very least she’s showing motivation to learn. I don’t see you going to a turkish website to learn something about web-development, I know I wouldn’t.

      • Ivanhoe

        @Dieter

        Hahahahha this is the biggest LOL ever on nettuts

        “She” is just here to promote his website and leave generic comments on every new post, same as 20 others

        The image is there just to get you interested to click on the website

        Their template is:

        Thank you for post on [post-topic]. Very useful tips. / etc

        You can see them commenting more or less on any nettuts post.

        And that’s crap about “discriminating” stuff. Purple asked to say in English, did not swear his (her) family

  • David

    Great God in Heaven that is complex! I’ve been studying PHP for about 2 years now and sometimes I don’t ever think I’ll ever be able to fully understand this stuff…

    • http://cmstutorials.org krike

      I feel the same way but I’m trying to learn as much as I can

  • Frank

    Why would anyone bother for another templating engine? Is no one using frameworks these days?

    • http://www.iamiivo.com Iivari Leinonen

      Well for starters, I have know idea how this is done and I wanna learn it.

      Secondly, my question is why would you use pre-build frameworks IF you wanna and can make one of your own? I know that it is easier to use one like CI ’cause it’s already there, but many programmers that I’ve worked with like to do it all by hand and create their own frame. So in those situations, this is a great tutorial for expanding your knowledge and adding more usefull stuff to your work. I’m not saying that there is anything wrong with using pre-build options but not everybody like to do that.

      So I think this is a good tutorial to have in here. Absolutely gonna check this out tonight.

    • http://www.wdonline.com/ Jeremy McPeak

      Progress is often the product of reinventing the wheel.

      • http://www.iamiivo.com Iivari Leinonen

        That is true. But mainly what I meant was that learning new things is never bad. After all, we have lots of different content management systems that all have their strong supporters. And of course we have this never ending Microsoft versus Apple debate. The point I’m trying to make here is that why should we all stick with a single option?

        There is nothing wrong if a person wants to develop themselves continuously. Frankly, I think everyone in this business should do so. Go and learn something new everyday ’cause this a type of work where you can never be fully ready. Or you can say that you are, but even you yourself know that there is still other stuff you could learn. If you think you master PHP, why not go and dig into Ruby? And after that C++ or C#? Or something like that, but you get the idea. And if a programmer wants a real challenge, go and start doing jobs as a designer. ‘Cause many developers and programmers can create good code, but as truly crappy when it comes to designing a website.

      • http://www.tttconsultants.com Terry

        Or atleast trying to apply a tire to the wheel…

      • http://www.iaddesign.com sarmenhb

        @Iivari Leinonen , you are right about wanting to expand on knowledge but in my opinion a web developer should master 1 server side language and for client side do what you want since there are alot of options. rather than learning a few serverside its best to learn just one and master it. even though you think you have mastered it you haven’t. since each project has its own challenge.

    • http://webhole.net/ miguel

      if people thought like you do we wouldn’t have choices on anything.

  • Marcin

    The contents of the tutorial seems to be very interesting, but it would surely benefit from some further editing before it was published. Some typos aside, the most annoying thing is that in every code sample, when the author wanted to highlight changes by making them bold, the tag is actually included and visibled in in displayed the source code, and changes are not bolded.

    • Marcin

      Ok, the last comment did not quite work as expected. I meant: the tag “strong” is actually included and visible…

    • http://www.jeffrey-way.com Jeffrey Way

      Okay, I figured it out what the problem was. I fixed that issue before the tutorial was published, but it turns out that the way our S3 accounts work, once you overwrite a new file, Tuts+ will still use the copied version. Complicated – but anyhow, that’s officially been fixed.

      • Marcin

        Thanks Jeff, I’m going to redownload it now.

  • fomigo

    Brilliant as usual, Jason! Thanks.

  • http://www.jacobbednarz.com Jacob Bednarz

    Excellent tutorial on rolling your own template system! I have seen many tutorials attempt to cover this subject however none have done it with such correct practises and professionalism as this one.

    Good work Jason.

  • http://www.webguide4u.com Vivek Parmar

    I’m only a beginner in PHP and only understand some of the terms of PHP could you guys help me out in letting some basic coureses on PHP.
    knows how to code wordpress theme but i’m not claiming that i know everything just search and do it by myself

    • http://www.iamiivo.com Iivari Leinonen

      Have you checked out “Diving into PHP” series here on Nettuts? It helped me to get started when I wanted to learn PHP.

    • http://ennuidesign.com Jason Lengstorf

      I suppose this is a good spot for some shameless self promotion: I’d recommend grabbing a copy of my book “PHP for Absolute Beginners” to get your feet wet and bring your PHP chops up to the level where you could take on this tutorial with no issues.

      Here’s an Amazon link for it: http://amzn.to/aUXusR

      Thanks for reading!

      • Casey Jeremiason

        Jason, I was wondering why you name looked so familiar until i looked at your website and noticed I own a copy of Pro PHP and jQuery, haha. Very well written, I can’t wait for the next installment, keep the work up.

  • http://www.emmyweb.com Dhruv Kumar S

    This is great,

    How about rolling our own Plugin System using PHP, I find this to be the hardest part and end up developing some crap*y architecture which works but need a lot of improvement.

  • Tray

    WTH is going on here? Am I missing the “more” link somewhere? Only 3 sentences to describe what the tutorial is about and the rest of the page pushing to sign up for premium. How do I know if it’s worth it from 3 sentences?

    Maybe nettuts should read a tutorial on marketing and conversions? Just buy the first one you come across no need to read a proper description eh?

    • http://www.seinoxygen.com Sein Oxygen

      Actually I found the same tutorial posted for free in another website. Not reuploaded, but the same functions and everything even more explained than in this tut.

      Yiu could google a little and will find it.