BrightContent-specific templates (AKA themes or skins) should enable rich features (through XSLT or other templating systems through e.g. Buffet/Smorgasbord). But we also want to be able to support plain templates, and in particular to import templates from other Weblog software (e.g. Blogger templates).
Native Bright Content templates generally comprise:
- A template driver file (e.g. in XSLT) used internally by BC to generate dynamic Web content
Supporting files for the template such as CSS or JavaScript files, and even XSLT intended for client browser transform
Location for supporting files should be straightforward and flexible. One key consideration is that while some users will just have BC host supporting files as static Web resources, some will want to serve these using Apache or LightHTTPD or even Tux for efficiency.
A mechanism for supporting e.g. Blogger templates might be an admin interface to upload a Blogger template XML which then translates it into a native BC template. This would mean this admin interface would need to know where driver and support files go, and would need to have access to these locations.
File system layout
Template and supporting files are bundled into a directory which can be placed anywhere. Some come with the Bright Content package and can be found at:
brightcontent/template
Example:
brightcontent/template/ionrock
Each template bundle must have a config.py (should we rename this to init.py? -- UcheOgbuji 2008-02-20 14:29:19). This file sets up an template object whose class depends on the type of template (only XSLT templates are supported in BC as shipped, but a plug-in could enable others). It includes parameters used to execute the template at run time.
Web-accessible support files are located within the template bundle, usually under an htdocs directory. For example:
brightcontent/templates/ionrock/htdocs/css/style.css
Templates can offer resources for plug-ins as well as BC core. For example the admin plug-in (ADD LINK) uses a template. A user can choose one templates for BC core and others for plug-ins.
User configuration
The main requirement is to specify the template directory (where all templates must be placed), to select a template within that directory, and to specify where on the Web to find support files. For example:
template_directory = %(here)s/../brightcontent/templates blog_template = bluesky template_files = %(base_url)sstatic/ionrock/htdocs xsltemplate_namespace = http://brightcontent.net/ns/
This requires that you make the static files available at a location matching template_files. You can do so using a static section in the BC INI
#Mount this app at %(base_url)sstatic [app:static] use = egg:Paste#static document_root = %(here)s/../brightcontent/templates
The following example also provides a template for the admin plug-in
template_directory = %(here)s/../brightcontent/templates blog_template = bluesky admin_template = ionrock template_files = %(base_url)sstatic/bluesky/htdocs admin.template_files = %(base_url)sstatic/ionrock/htdocs xsltemplate_namespace = http://brightcontent.net/ns/
File system layout -- alternate proposal
Template files used internally are sourced within the Bright Content package at:
brightcontent/template
Example:
brightcontent/template/myskin.xslt
BC code accesses such files using Python setuptools resource bundle access
Web-accessible support files are sourced at:
brightcontent/htdoc
Example:
brightcontent/htdoc/myskin/css/main.css
If the user has set in the INI:
weblog_base_url = http://brightcontent.net/blog/
Then BC will make the above example accessible at
http://brightcontent.net/blog/myskin/css/main.css
Hosting multiple Weblogs
...
