BMC/UUP-SITE - Web site/application rendering.

This library takes a object oriented approach at building web sites by separating page layout from content. It supports multiple theme, rendering page direct or using a dispatcher (routing) script.

Site Layout:

Proposed site layout. All directory location are configurable in config/defaults.site that is used to initialize a page class instance.

    site/
      +-- htdocs/                       // Document root
      |     +-- theme/xyz/assets        // Static support files for theme xyz
      |                     +-- css/
      |                     +-- js/
      |                     +-- img/
      +-- template/                     // Page rendering templates (themes)
      +-- locale/                       // Support for locale (gettext)
      +-- vendor/                       // Composer packages, including uup-site
      +-- composer.json                 // Site project composer file
      +-- Makefile                      // Compile locales (PO-files).

Setup:

Add repository URL http://it.bmc.uu.se/andlov/php/proj/bmc/uup-site to composer.json. Install uup-site pages using composer:

        bash$> cd /var/www/www.example.com
        bash$> composer update

Make config protected copy of config/defaults.site:

        bash$> cd vendor/bmc/uup-site/config
        bash$> cp config/defaults.site.in config/defaults.site

Open config/defaults.site and set default options. Use config/apache.conf to enable page routing.

Themes:

All themes should at least provide the standard.ui template, but it's up to user to define any number of *.ui files as needed. See template/default for example on theme construction. Download and install themes from the uup-site project page.

Example:

Using direct rendering:
        // 
        // Assume virtual host defines include path to root directory:
        // 
        require_once('vendor/autoload.php');

        use UUP\Site\Page\StandardPage;

        class IndexPage extends StandardPage
        {
            // Define the printContent() member function at least.
        };

        $page = new IndexPage();
        $page->render();
Using page routing (pretty URL's):
        // 
        // The dispatcher.php (router) has already setup autoloading, no need
        // to explicit call render() either.
        // 
        class IndexPage extends StandardPage
        {
            // Define the printContent() member function at least.
        };

More examples is included in example directory in the source package.

Infrastructure:

Menus and publish information can either be defined by having custom files in the page directory or programmatically by redefining menu content in the page constructor.

  • See example/context for infrastructure example.
  • See example/multi for example on programmatically defined menus.

The site config file has some influence on menu handling also.

Real world examples:

Some sites are built on bmc/uup-site: