|
You are here: Home / Documentation / How To: XT Template Essentials |
How To: XT Template EssentialsIncludesWhile boxes are the preferred method of inclusion in Sitellite, as they adhere to Sitellite's automatic access control and configuration facilities, I will still document includes here as well, since they can present an elegant, simple, and often powerful solution to certain problems.First, let's look at the most basic file inclusion: <xt:tpl> This will include the file footer.html into your template, treating it as a literal inclusion (ie. not performing any transformation on it at all). As you can see, the lack of transformation is due to the type="plain" attribute. The default inclusion type (ie. when no type is specified at all) will treat the included file as an XT template itself, and transform it prior to inserting it into the current template. Next, let's look at the real potential includes possess in maintaining previewability. <xt:tpl> As you can see, the ability to specify fake data, including XHTML tags, is a powerful feature of the XT template system. Finally, before moving on to boxes, let's take the include facilities to a new level, and include content from another web site. But even better, let's include headlines from another web site, pulled from an RSS file. <xt:tpl> Pretty cool, eh? However, please beware that while this capability looks really cool, it is not a complete example yet. To be respectful of other web sites, you should always cache RSS feeds locally and only request them periodically -- otherwise for each visitor to your site, there's another retrieval of the file from their site. To finish this example then, you'll want to add the following to the template: <xt:tpl> Please note: If you run into errors with caching, make sure the cache folder and those inside of it are writeable by Sitellite. Next Up: Boxes Page 1: Introduction |
|
Copyright © 2008, SIMIAN systems Inc. All rights reserved. Privacy policy Some of the icons on this site were created by the Gnome Project. |