Want to build a site? A small one for your homepage or a large corporate portal? Already have a page that looks great and want to populate it without copying its layout in all your content files? Or maybe you are sick of fixing the same line on all the pages of your site? Well, let's do it together. We are going to use templates... Templating practice is very straightforward: instead of supporting many files with the same layout and different content, you just define a single template file and many content files. Template file contains common page layout while content files -- the varying contents. The final site is built from the content (source) files by inserting them one by one into the template and thus generating destination documents in appropriate folders. Of course some kind of documents like JPEG images don't need to be parsed but will be copied to the destination as is. Open Site Builder templates (there actually may be more than one template for a site, for example a home page may use a different layout from other site) are HTML files containing special placeholder which defines where the text from content files will be positioned in the template. Different page areas (like menus or navigation bars) may contain slight design deviations from page to page while staying consistent with common site design. Those parts of a main template which change we will call sections and store them in separate files. Template may contain placeholders for sections just like for content. Sections may vary on per-directory or even per-file basis. Section files in most cases define a submenu information for a given zone of a site. For example, a submenu in your About zone may contain "Mission", "Contacts" and "Partners" links, while a submenu of Jobs zone will contain "Open vacancies", "Add resume" and "Check my resume" links. Sample site structure may look like this: index.html (Welcome page) | +-about/ (About zone) | index.html (Mission) | contacts.html (Company contacts) | partners.html (Business partners) | +-jobs/ (Jobs zone) | index.html (Current vacancies) | add.php (Add resume) | check.php (Check my resume) | +-products/ (Products zone) index.html (Price list) product.php (Product description) If this submenu needs to have more than one implementation for the zone (for ex. you decided to paint current page name in bold when user loads it, so on Mission page "Mission" will be in bold face while on Contacts page we emphasize "Contacts") you may create different sections for the same zone and include a command in your content file notifying that on this page it needs to use another section instead of a standard one. A Mission page in About zone may look like this: After template, content and section files are presented, we need to define the main configuration file which contains the control information about where to take the template and content files, how your sections are stored, the target location for assembled files and so on. Except the above mentioned parameters your config file may define special "entities", which are then usable in your templates, section and content files. These entities are simple strings and behave just like HTML predefined special characters encoded in When you become more familiar with entities you may notice that it would be of a great convenience to have a construct like functions or macros in C, a dynamic entity, where you may pass parameters to it. This is possible: you can define a, say, Actually you may have files on your site which you want to be copied as is, without using templates. Those may include different binary data like images or PDF documents. Specifying the extensions for those files that you want to just 'copy' and others for files that you want to 'build' you explicitly set the scope of files that will be present at the target location. Files outside of this scope will not be processed. The process of building a site is accomplished by calling the file That's almost all. Actually there are some supplemental actions like automatic creation of sitemap file, running programs on destination files after update (if you use some kind of encoder for your commercial scripts, all updated php files need to be re-encoded after the build) and setting SQL permissions for specified roles (each directory may define its own SQL role and grant it different permissions). For a primer on assembling a sample site see the Tutorial document. For a full list of parameters available in Open Site Builder see the Commands Reference document. |

