yo5 web site framework

Yo5 is a small web site framework targeting PHP5 plaforms. It is the software which runs this web site (in fact, all of my sites).

Yo5 is primarily intended to run my sites, and that means it is intended to be re-usable, easy to maintain, and flexible enough to allow customization of each site without having to modify the yo5 code for each specific site. The target audience could be said to be, "programmers who want a small site they can control, but don't need to invest too much time in controlling."

It can be downloaded here:

Filename Size (bytes) Date (Y.M.D)
yo5-20070616.tar.gz 20897 2009.07.27
yo5-20070613.tar.gz 21916 2009.07.27

Rather than repeat a lot of text written elsewhere, here's the doc file which comes with the source tarball:
This is the README file for the yo5 PHP framework. It explains how to
install the software and the basics of setting up a web site using it.



Software home page:



     The majority of the code is in the public domain. Some code,
     namely yo5/include/Yo5TemplateParser.class.php, is released
     under the GNU LGPL. All code which does not have an explicit
     license in the code file can be assumed to be Public Domain.


- PHP 5.x. Exactly which versions might/might not work is unknown.
  Don't even try it on PHP 4.x - this software depends on the
  object-passing conventions introduced in 5.x.

- A Unix-like system. Many paths in the code are hard-coded for the
  '/' directory separator. No effort whatsoever will be made to
  support Windows-based web servers.


- Easy and complete control over the appearance of the web site via
  "themes". Integration of content pages into any the overall site
  layout is trivial and independent of the current theme.

- Each site can support an arbitrary number of languages, and the URLs
  for the pages stay the same regardless of the current language.

- Pages can be constructed from "building blocks" by using template

- Very hackable. The code base is fairly clean and more or less

- Internally supports an arbitrary number of site users, but these
  features are not complete.

- Allows site-specific global and per-theme PHP code.


- Requires that it be installed at the root level of the site. Getting
  it to work as a sub-site would require a bit of hacking.

- Doesn't come with any significant applications written for the
  framework, so out of the box it is mostly suitable for "simple"
  sites (that is, content, as opposed to applications).


First, unpack the distribution file:

       tar xzf yo5-xxxx.tar.gz

(or similar)

If you are running a local apache installation and want to set up a
virtual host for this site, then simply add the host's name to your
/etc/host file and add an entry in your apache configuration,
something like:

    ServerName yo5
    DocumentRoot /home/me/yo5-xxxx


The site is now installed and ready to go but doesn't do very much.

The first thing you'll normally want to do is create your own site
layout theme. This is simple to do:

       cd yo5/themes
       cp -rp default MyTheme

now edit /yo5-config.inc.php and change the line which looks like:

    yo5_config_set( 'theme_name', 'test' );

and replace 'test' with 'MyTheme'.

To change the overall site layout, change the files under
yo5/themes/MyTheme, starting with yo5-site-layout.php. That file
controls the overall layout of every page. The yo5-site-header.php and
yo5-site-footer.php files contain the header/footer parts. You can
remove them by simply removing the references to them in
yo5-site-layout.php. The layout file controls most aspects of the
look/feel of the site, including the style sheet.

While you edit those files, simply keep reloading the site in your
browser until you're happy with it. To edit the top-page content,
edit the file content-en.html (you can also rename it to content.html
if you know you will never need multi-language support).


Adding a new page is a two-step process. First, add a subdirectory, if

	mkdir subpage

Now create subpage/index.php and subpage/content.php. The index.php
should look like this:

       require( '../yo5-bootstrap.inc.php' );
       yo5_content( 'Page Title Goes Here' );

The content.php file should then contain any content which you want
to appear in the "content area" of the page (as defined in your main
layout page, mentioned above).


If you want to add custom functions and whatnot, add them in
/yo5-localcode.inc.php and/or /yo5/themes/MyTheme/yo5-localcode.inc.php,
both of which get included (in that order) at the end of the yo5
bootstrapping process.

You can add theme-specific configuration options to
/yo5/themes/MyTheme/yo5-config.inc.php, but be aware that the -config files
do not have access to the whole framework API because they are read
relatively early in the bootstrapping process.


If the framework sees a $_REQUEST var named 'yo5_language' then it
sets the session-wide language to that string. When the language
changes, the lookup path for content pages changes. This allows a
site's pages to have identical URLs for all languages (while
user-friendly, the disadvantage of this is that it makes it difficult
to get Google to index languages other than the default).

If you want to use a default language other than English, change this
entry in yo5-config.inc.php:

  yo5_config_set( 'default_language', 'en' );

Change 'en' to the language ID you want to XX, where XX is the
language identifier. yo5 does not actually rely on any specific
language naming convention, so you could use yo5_language=klingon or
yo5_language=elvish, for example, as long as you have the content
pages in place for that language.

If you want to support multiple languages, the easiest way to do so is
to create content pages named content-XX.php (again, XX is a language
identifier), but you can also instead create subdirectories under each
page's directory, named content/XX, and place a content.php (or
content.html) in each of those directories. e.g.:



To see (and change) how the current language setting affects the
search for content pages, search yo5-config.inc.php for
'template_path' and 'template_path_extensions'.


Since i don't honestly believe that anyone aside from myself will
actually use this software, i won't document the more advanced
features here. If you're intested in hearing about them, please feel
free to get in touch:



The "yo" series of frameworks began development way back in 2001,
though until 2003 it was called "radioaqtiph". It was originally
written to replace PHPNuke, which i considered to be a good-looking
but absolutely horribly-written piece of software. After some time in
service as a rather unique content management system, it was rewritten
from scratch with the goal of more flexible look/feel management, the
idea being to use it to deploy dozens of "garbage sites" for the
purpose of "search engine optimization" (which, ashamedly, was the
goal of my employer at the time).

In June 2007 the yo5 rewrite started, with the explicit goal of taking
advantage of newer PHP5 features, like exceptions. Also, differences
between PHP4 and PHP5 regarding how objects are passed around (by copy
or reference) made it increasingly difficult to support some of the
older code on both platforms. So... it's called yo5 not because it is
version 5 of yo (it's more like version 3 or 4), but because it
targets PHP5 platforms.

This framework is highly tweakable and is used as the basis for
several "production" web sites, e.g.:


(Disclaimer: i manage those sites)

Several intranet web applications in Hypovereinsbank, in Munich,
Germany, were (2005-2007) based upon an earlier version of this