Setting up Template Blocks for OFFLINE use

If you want to use Template Blocks on your local server as a web design/compiling tool, this is the guide for you. For users that don’t have a local server but want to work with the template engine offline, XAMPP is recommended as a light-weight and efficient solution.

Some of this information may be different depending on the platform you are working (Windows, Linux, Mac OS). In any case you will need Apache installed and running beforehand.

To access Template Blocks locally you will need to map a domain name to point to its location. That way you won’t have to install Template Blocks on the root of your server or fight with custom paths that may cause glitches to the engine. Instead you can work with Template Blocks on a top domain level, wherever it is on the local server.

Setting up a VistualHost in Apache

Go to where your Apache is installed and find to the “conf/extra” sub-folder. Open “httpd-vhosts.conf” in a text editor. You’ll find some commented examples how to setup a VirtualHost entry - write at the bottom of the file your own. These are the ones I use on my setup:

NameVirtualHost 127.0.0.1
 
<VirtualHost 127.0.0.1>
  DocumentRoot "C:\Server\htdocs"
  ServerName localhost
</VirtualHost>
 
<VirtualHost 127.0.0.1>
  DocumentRoot "C:\Server\htdocs\templateblocks"
  ServerName templateblocks.dev
</VirtualHost>

Note that you should change the IP (127.0.0.1) if your server has another one and the document path and domain name as suited.

For Windows users

Additionally you’ll have to tell windows to redirect the domain name (templateblocks.dev) to the local server and not make a DNS look up for it online.

For this go to “C:\WINDOWS\system32\drivers\etc\” and open the “hosts” file in a text editor. There you will possibly find a line already redirecting yo your local server, mine is:

127.0.0.1       localhost

Under that line make a new line for your custom domain (templateblocks.dev)

127.0.0.1       templateblocks.dev

Save that file. Now when you enter “templateblocks.dev” from a browser windows knows to redirect it to your local server and your local server knows to redirect it to the appropriate folder.

Re-start Apache and load a web browser to you new a top level domain.

Enjoy working with Template Blocks offline.

Leave a Reply