|
You are here: Home / Documentation / Sitellite as a Content Publishing Engine |
Sitellite as a Content Publishing EngineCreating a new output modeBefore I can show you how simple it is publish sites using new output modes, I'll need to walk you through creating a second output mode to use. To do this, create a file called "docbook.default.tpl" in your inc/html/default folder. Enter the following template data into it:<xt:tpl version="1.0"><xt:xmldecl version="1.0" encoding="ISO-8859-1" />This will be our template for rendering a simple DocBook formatted output of our web site. I'll skip the explanation of the template itself, other than to explain its file name a bit more clearly. All template files end in ".tpl", and the middle of the name represents the template name itself. This way, you can create multiple templates within the same set, for the same output mode. This allows you to build web sites with a different look to different parts of your web site, from simple changes like dropping a 3rd column for wider content pages, to larger-scale changes, such as sub-sites that look entirely different from the parent site. The first part of the template filename is the output mode of that template. In our example case, the output mode is "docbook", and we're creating an output mode for the DocBook file format, which you can learn more about at the official DocBook web site: http://www.docbook.org/ Next, save the following code to a file called inc/app/example/lib/DocBook.php: <?phpThis is a content filter, which we will call to transform the body of our page, which is stored as XHTML data, into DocBook-compliant markup. This filter is very elementary, and in a real world scenario we would probably add to it to support additional tag transformations. For now however, this will suffice. Next, add the following to your inc/html/default/modes.php file: [docbook]Now we have our new output mode installed and ready for testing. For starters, try the following URL: http://www.yourWebSite.com/index?mode=docbookPretty cool, huh? The modes.php file we added to above is used to tell Sitellite how to handle our output mode properly. In the case of our docbook output mode, we need to tell Sitellite that the HTTP content type to send to the browser is text/xml instead of the default text/html, and we need to tell it that we want the body field to be filtered by our content filter before being inserted into the output mode template. Next: Specifying the output mode Page 1: Despite Sitellite having a very ... |
|
Copyright © 2008, SIMIAN systems Inc. All rights reserved. Privacy policy Some of the icons on this site were created by the Gnome Project. |