Child pages
  • PHP Template Engine (as of v3.0) How-To
Skip to end of metadata
Go to start of metadata

The main feature in Newscoop 3.0 is the change of the template engine. Prior to 3.0 Newscoop implemented a template engine written in C++. Although it was successfully used, we decided to replace it because of some important points:

  • first reason
  • second reason
  • ...

This How-To is aimed to help users to understand the new PHP template engine, the main concepts, how it works and how you can build effective templates with it. We want to do this the easier way, that is comparing old syntax with the new one, so let's start.

How different it is

Not so much. In terms of internal stuff it is totally different as it is fully PHP-based, but we are not going to take care of internals here. The important thing is this template engine was designed to be closer to the old one in terms of how users write template files. Every template engine function was migrated and you will find it works almost the same way or just easier.

New functionalities are not going to be present with the first release, but you should expect cool things coming up as they will be easier (and faster) to implement.

Requirements (a.k.a What do i need to get it running?)

Now you need far less dependencies to get Newscoop working on your box, basically all what you have to have is:

  • [MySQL] server.
  • Apache web server.
  • PHP 5 supported.
  • mod_rewrite compiled/enabled within Apache, this is necessary if you want to be able to use short (friendly) URLs.


While there will be a web-based installation (which is nice) available, right now you have got to do it by hand, anyway it is less painful than old style. Follow this straight forward steps:

1) Unpack the Newscoop file.

Unknown macro: { holman@mutant}

2) Move the xxx directory (which holds the application files) to a valid document root within your Apache web server.

Unknown macro: { holman@mutant}

3) Configure Apache.

4) Create and populate the database. We assume you have got root access to the mysql server.

Unknown macro: { holman@mutant}

5) That's it!

Template Engine: 2.x vs 3.0

Setting the Context

These both statement sets will set the content context that matches to Publication number 1, English Language, Issue number 1, Section number 60 and Article number 52.



Unknown macro: { <!** Publication identifier 1> <!** Language name English> <!** Issue number 1> <!** Section number 60> <!** Article number 52> <!** Section off> }



{{ set_publication identifier="1" }}
{{ set_language name="English" }}
{{ set_issue number="1" }}
{{ set_section number="60" }}
{{ set_article number="52" }}

{{ unset_section }}

Local Environment



Unknown macro: { <!** Local> <!** Publication identifier 2> <!** Section off> <!** EndLocal> }



{{ local }}
{{ set_publication identifier="2" }}
{{ unset_section }}
{{ /local }}

  • No labels