One of the reasons why I really like Phalanger PHP for .NET is that it allows me to use the Smarty template engine with Syrinx CS. I have not seen a template engine in .NET as good as Smarty and it's documentation is fantastic. Rather than building site pages using ASPX, we can now build pages using PHP and Smarty in the .NET environment. The PHP can use the Syrinx CS class libraries like they are PHP libraries, which I find amazing.
What is Smarty?
Smarty is a PHP template engine that can take a template and some data and blend it together to create an output. One obvious use for this is to have html templates, that use Syrinx CS data like articles, products, events, etc. to make html pages that have the content embeded directly. At that point, the generated html page can be viewed without needing to query Syrinx CS for the content again. Smarty is a very powerful template engine that can easily be used to build elaborate web sites.
One cool aspect of Smarty is that you can render a template to a string rather than being sent to the browser. By writing the template output to an html file, the rendered content can then be viewed direct in the browser itself. The new page becomes a static snapshot of whatever content was rendered by the template.
I spent some time experimenting and was able to create a smarty theme, a few smarty templates, and a little PHP and recreated the SCS Admin and Developer documentation that was originally built using ASPX that used .NET controls. The pages are still dynamic like the ASPX, with the only difference being that its PHP and smarty templates rather than ASPX and .NET controls. As the user navigates the documentation, the PHP is executing and the templates are being rendered just like the ASPX.
I then built a php function that would loop through a list of articles and generate a new html page per article using a Smarty template. By writing a few helper functions, I was able to use the same template from the dynamic PHP version. Within just a few seconds, it generated a collection of html pages that looked just like the dynamic PHP.
You can see the static version of the SCS documentation with the link below, but note that it wont always be showing the latest version of the documentation as it is just a proof of concept.
View Static Admin Guide versus View ASPX Dynamic Admin Guide
There are several benefits from being able to generate a static snapshot of site pages like this. The main benefit is that the content can be viewed without SCS and its database. Getting SCS up and running on a web server does take some time, and requires a certain technical experience. Viewing static html files from your local storage is as basic as it can get. Any PC running Windows, Linux, Mac, etc., can view those files.
Another benefit is that those files require no server resources if hosted within a live site. Running any system like SCS (such as WordPress, Drupal, etc.) where content is generated per page request takes server resources per request that is typically much higher than the resources needed to send a static html file. For certain types of content, there is no reason to regenerate the pages per page request.
This is the first step for the static build system I want to create for SCS. The static build contains a collection of steps, with each step generating some aspect of the static site pages. There would be another admin page to help trigger the build process, and perhaps it would offer the ability to pick the specific steps to be executed rather than just running the whole build.
With a good static build system in SCS, a site owner can generate a static snapshot of their site, which along with site backup zips, should give them the assurance that they have a copy of their site that they can do something with.