Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

You know how Wordpress, Posterous, Blogger and the like all allow you to upload your own custom-designed templates? And if you look at the Source code of those templates from within their Template Designer's 'source code' option, you can see heaps of variables everywhere, like:

<html>
<head>
<title>{PageTitle}</title>
</head>
</html> // for example

How, or where would you create such a templating system, or are there open source ones, or where can you learn more about them?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Creating a templating system would require you to learn and use a programming language such as Ruby or PHP, then code the templating system and content management system and host it on a web server.

There are hundreds of existing templating systems for PHP alone. Searching Google for "templating PHP" or "templating Ruby" will take you to resources to help.

For example, an article from Smashing magazine titled "Getting Started With PHP templating" talks about the existing open source templating systems and how to use them with PHP.

If you're just looking to keep a blog, coding your own templating system is probably overkill, and you might be better off learning how to create a theme using the existing templating system for your blogging platform of choice. (For example, you could start here to learn how to theme self-hosted WordPress blogs.)

But if you're interested in learning to program, templating systems can be very useful ways of keeping complex code out of your HTML templates and making your application easier for non-developers to use and adapt.

share|improve this answer
    
Would C# suffice? I haven't used PHP in 3 years (focusing on C# and .NET languages) –  jay_t55 Aug 16 '12 at 7:41
2  
@JTS-V Sure! Use whatever language you're most comfortable with. There's a discussion over on Stack Overflow about C# templating engines that might be of interest. –  Nick Aug 16 '12 at 7:47

The Template Toolkit (TT2 for short) has been around a while. It's written in Perl, but you don't need to know Perl to use it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.