A weblog about Ode (ode-is-simple.com)

Thu, 15 Apr 2010

Welcome to the first release of the text_page theme.

text_page, a new theme for Ode.

Get text_page theme

It's a very straightforward single column design with flexible width. Without sidebars it might not be the right default theme for everyone, but it's a great theme for reading longer posts.

Before you read about it, take a look.

Read this page using the text_page theme.

With this theme we can start to see the benefit of Ode's dynamic theme mechanism. We don't have to choose just one. We can have any number of themes active at the same time, all working together. This allows us the ability to really get creative while providing visitors to our sites the best possible experience.

For example:

Let's say the default theme on my site is a two column fixed width theme. I may like this layout because it's easy to work with, and allows me to have a sidebar where I can put info that I want to take out of the normal flow of posts (which start off at the top of category pages and the site root but eventually fall out of view, replaced by newer content).

In general that arrangement could work well, but when I have an especially long post I may want to maximize the amount of space in the browser window dedicated to the post. In this case, the sidebars are just in the way.

I can create a link to the long post referencing the text_page theme even if it's not the default.

Example:

http://ode-is-simple.com/cgi-bin/ode.cgi/dir1/dir2/long_post.text_page

Without specifying the theme at the end of the post's filename, e.g.

http://ode-is-simple.com/cgi-bin/ode.cgi/dir1/dir2/long_post

visitors will see the default two-column theme, but we can override the default on the fly.

We might even set the one column theme as the default for categories that frequently contain longer posts. We can have a different default in every category if we want to do that for some reason.

This is just the beginning of what we can do with Ode's themes. Dated themes for example allow us to construct links that roll a theme back to recreate the design of the site at any point in time.

text_page is also a good theme to look at if you're just getting started with theme design. As you'll see, there isn't very much to it, so it's a gentle introduction. I've added quite a bit of structure to help you find your way around.

By the way, if you think the header looks familiar, I've appropriated the look of the header (not the markup or style) from an email I recently received from posterous. If you'd rather change it you can easily do that by modifying the included stylesheet (e.g. change the background color, or the position site_title). You can also get rid of the header altogether. If you need help modifying the theme, bring whatever questions you have to the forum.

By the way, Posterous is a really nice blogging service. You may want to check it out if you haven't before now. But what they call simple I call easy. To my way of thinking, simple means you know how it works. We can accomplish the same thing (and more) AND understand how Ode does it.

The procedure for 'installing' a theme for Ode is always the same.

Any category (directories and subdirectories under the document root) may contain a 'themes' directory (which is literally a directory titled 'themes'). If you don't have a themes directory in some category where you would like to put a theme, just create it.

With the 'themes' directory in place, just drag and drop the folder containing the theme you want to install to the themes directory and you're done.

Navigate to the category containing the 'themes' directory where you just installed the new theme (or any subcategory) and make a request that references the theme name.

If the theme you just installed is set as the default in your config file ($default_theme), the theme will be used for every request that does not specifically reference another one.

For example, if I install the text_page theme and set 'text_page' as the value for $default_theme in the config file, then text_page will be used for every request. For example, the following two requests are equivalent, if text_page is the default theme:

http://sample.net/cgi-bin/ode.cgi/ \ 
programming/perl/learning_perl/some_post

http://sample.net/cgi-bin/ode.cgi/ \
programming/perl/learning_perl/some_post.text_page

Of course I can specifically request another theme at any time, for example

http://sample.net/cgi-bin/ode.cgi/ \ 
programming/perl/learning_perl/some_post.html

http://sample.net/cgi-bin/ode.cgi/programming/perl/ \ 
learning_perl/some_post.any_other_theme_name

After dropping the new theme into some 'themes' directory, it's installed. The script will immediately start using the theme when appropriate. Be aware that you should probably check the paths to resources referenced by the theme (e.g. linked stylesheets, images, etc.)

If, after installing a theme the site as displayed in a browser looks 'broken' in some way, you're almost certainly dealing with a path issue.

Check the path to the stylesheet which you'll find at the top of the page theme file. If the theme looks 'almost right' but is missing images, then check all of the img tags in the page file.

Right now all of these paths must be set manually which means it's almost certain that you'll need to modify the theme so that the references to resources associated with the theme point to the correct locations for your installation. This is entirely unnecessary. The script can take care of this. It's an oversight on my part that this isn't how it works already. I'm planning on making the necessary changes soon. And in the future, you should not need to make any changes to help a theme find its associated files.

Get text_page theme