![]() |
![]() |
Version: Beta 3
AutoTheme is a Theme System script for the PostNuke CMS. I've seen many posts from new users inquiring about every aspect of the current PostNuke theme system and related files. The current theme system usually requires you to be somewhat familiar with PHP and the PostNuke architecture. AutoTheme attempts to remove most of this complexity. If you are not very familiar with PHP and/or PostNuke, don't open any of the PHP files included. Actually, if you are a seasoned PHP and/or PostNuke developer, definitely don't look at these files, they are scary (I'm a descent hack, but no developer)!
AutoTheme's primary benefit is providing users the ability to create PostNuke themes in HTML using their favorite editor, with little or no use of PHP. In addition, AutoTheme provides easy customization of block display and custom themes for different modules.
Regardless of how themes are built, a base understanding of PostNuke is needed. Standard PostNuke installations make use of four main elements in the layout. Left Blocks, Center Blocks, Right Blocks and Modules. You can create and modify the blocks via PostNuke's administration menus, but the theme controls when, where and how these four elements are displayed. Two additional elements are used for the news, the Summary Article (displayed on the Main Page) and the Full Article (displayed when the user reads the Full Article usually by clicking Read more...). See an example:
[ Example ]
Unzip AutoTheme into your PostNuke themes/ directory. You may safely change the name of the AutoTheme directory if you wish. You may now browse to your PostNuke site and change the theme to the new AutoTheme in Administration, Settings, or start your customization.
POSTNUKE DIRECTORY
|
-----themes
|
-----AutoTheme
|
-----docs
|
-----images
|
-----includes
|
-----style
AutoTheme is a Theme System, not a Theme. The included HTML templates and images may be used as is or modified to fit your needs, but they are only examples. You should use your own creativity to build a custom theme using the AutoTheme functionality. The following HTML template files are included with AutoTheme and are meant to be examples of the functionality of AutoTheme. Your site may require fewer files or more files. You may safely delete these custom files if you wish.
The following images are included with AutoTheme in the images/ directory and are meant to be examples of the functionality of AutoTheme. You may use fewer files or more files. You may safely delete these custom files if you wish.
AutoTheme looks in its directory and uses standard HTML files to display your Main Page, Left Blocks, Center Blocks, Right Blocks, Summary Articles and Full Articles. Each HTML file contains commands, actually HTML comments that tell AutoTheme what to do. You can configure what names to use for these files or you can modify or replace the existing templates. If you want to change the configuration (optional), here is an explanation of the settings in theme.cfg:
[ theme.cfg ]
It's very easy to design AutoTheme templates. Just use your favorite HTML editor and design a Main Page template (theme.html), Left Block template (leftblock.html), Center Block template (centerblock.html) and Right Block template (rightblock.html). In addition, the PostNuke news module uses the theme for the two types of article displays, Summary Article (summary.html) and Full Article (article.html). Block and Article files should not contain <html>, <head> or <body> tags. Only the tags necessary to construct your Block or Article.
As you design your Main Page template, keep in mind the basic layout elements of a PostNuke site. The locations where these are to be placed are specified in your HTML templates using comment commands, standard HTML comments that have an embedded AutoTheme command. AutoTheme commands are enclosed in brackets [ ] and take the following form:
Example: <!-- [command] -->
Here is a list and explanation of the included commands:
[ Commands ]
When you build your templates you may use cascading style sheets to define the appearance of certain tags or elements. This style sheet needs to be saved under themes/AutoTheme/style/ as style.css (main style sheet) and styleNN.css (used for Netscape navigator). These may contain style differences but most likely will work if they are the same. You may include your style sheet in the header of your theme template while editing, but the <link> reference will be stripped out by AutoTheme and PostNuke will dynamically include one or the other depending on the viewer's browser. As outlined in the theme.cfg example, you may also define an additional style sheet to be included after these PostNuke default ones.
The base location of your PostNuke page is where your PostNuke index.php resides. Therefore, images and other files such as scripts that are in a sub-directory of your AutoTheme/ directory will need to use a path relative to where the PostNuke index.php resides, which is themes/AutoTheme/. So if you have your images in the images directory an <image> tag and <script> tag would look like this:
Example: <img src="themes/AutoTheme/images/image.gif">
Example: <script src="themes/AutoTheme/script.js">
Two commands are available for referencing paths in your templates. The first is for your theme directory and the second is for your theme images directory:
Command: [theme-path]
Example: <script src="<!--
[theme-path] -->script.js">
Command: [image-path]
Example: <img src="<!--
[image-path] -->image.gif">
Of course if there isn't a command for what you want to do or if you don't like the way a command functions, you can still use PHP code in your HTML templates.
Example: <td><?php echo $some_var; ?></td>
Language support is included with AutoTheme and is available by creating a global.php in themes/AutoTheme/lang/yourlanguage/. All text in current and future AutoTheme commands use language variables from the theme or from the main PostNuke global.php. English is included with AutoTheme in themes/AutoTheme/lang/eng/.
Right-To-Left type is also supported and is automatically activated when the user's language is a RTL language. Arabic is currently supported. If you know the PostNuke language abbreviation of other RTL languages, send them to me and I will include in the next release.
Multi-Sites are automatically supported in AutoTheme. AutoTheme themes may be included in the main themes/ directory of your PostNuke site or in a themes/ directory of a multi-site directory with no modifications to the theme or AutoTheme code. When using an AutoTheme theme in a multi-site directory, only that site has the ability to use the theme. When in the main themes/ directory, all sites are able to use the theme.
Every block has a unique name that is configured in PostNuke Administration / Blocks. By configuring the values in theme.cfg for specific blocks by name, you can define custom templates that are used only for that specific block. The old style looked for an HTML template (.html, .htm, .php) with the same name as the block and used that as the template. Images for custom block titles were treated in the same fashion (gif, jpg, png). Now to have a custom block title image, include that image in the custom block template.
The following is the old way that will still work in this beta only (this method will not be available in future releases):
If you create a block in PostNuke you can save an HTML template (.html, .htm,
.php) with the same name as the block (strip all non-alphanumeric characters) in the themes/AutoTheme/
directory and the custom template will automatically be used for the block
instead of one of the standard block templates. There is also a Right
Block titled Related Links that is displayed when you read a full Article if
"Display Right Blocks in Articles?" in the PostNuke Administration Settings is
set to "Yes". This block can be customized as well, using the filename
relatedlinks.html. Example: themes/AutoTheme/poll.html Example: themes/AutoTheme/whosonline.htm Custom Block TitlesIf you want all blocks to use the standard block template, but you want custom images for the titles, you can save an image (gif, jpg, png) with the same name as the block (strip all non-alphanumeric characters) in the themes/AutoTheme/images/ directory and the image will automatically be used for the title instead of the title text. Example: themes/AutoTheme/images/mainmenu.gif Example: themes/AutoTheme/whosonline.jpg |
The theme.cfg contains settings for each type of block that lets you determine when to display the block. You may display the block on all pages or just the main page.
Every module has a unique name that is configured in PostNuke Administration / Modules. By configuring the values in theme.cfg for specific modules by name, you can define custom templates, style sheet, image and colors that are used only for that specific module. In addition, you can control what blocks are displayed on a per module basis.
AutoTheme provides support for Nuclei Blocks 2.5. This enhancement allows eleven additional blocks to be named and used in PostNuke. The blocks are Area1 through Area9, Top and Bottom. These blocks as well as the standard Left, Center and Right Blocks can be renamed in the nuclei.cfg file and just like the standard blocks you can configure what file names to use for the Nuclei block templates in the theme.cfg file.
The Nuclei Blocks Module is a great module hack by David Dyess II (dem0). You can download it from Tangant.
Since you are creating your own templates for the Main Page and for the blocks, then you have a lot of flexibility. Traditional PostNuke sites display their blocks vertically. With AutoTheme it's very easy to display them horizontally. Let's say in your Main Page template you have a <td>, if you put a <table> in that <td> then your block templates can be <td>s inside of that <table>. So each new block creates a <td> which will be next to the previous <td> until you define a new row <tr>. This same affect may be acheived if your blocks are tables by setting align="left" which is analogous to floating left.
The most common commands used in PostNuke themes are already available, but AutoTheme can be easily extended by adding additional AutoTheme commands and the associated PHP statements or PostNuke functions that the commands execute. Commands are defined in themes/AutoTheme/includes/commands.inc.php.
Please send bug reports or feedback to abracadaver@mckenzies.net or visit http://spidean.mckenzies.net
AutoTheme is Free Software released under the GNU/GPL license.