Projects/ HOWTO


Capacity is a versatile framework which helps you to construct your page by focusing on the content. Your pages will be simple PHP-files which include predefined header and footer. This header/footer layout the page, you only provide the real content and menu structure.

Example PHP-file

Any normal page just contains:

   $page_title = "Page Title";
   include "";
 Content of the web page
 <?php include ""; ?>

The magic

For each subsite, a in the toplevel directory of this page, which would be equal to the later documentroot on the server in many cases, may be created. This include is used by the, it should contain some information about your site, like it's name and the email address of the webmaster, this will be used by header/footer to setup the page correct.

An example would be:

   // promote which subdomain we are
   // we are in this case!
   $site = "www";
   // use new style ;) yeah
   $templatepath = "newlayout/";
   // promote title to use
   $site_title = i18n_var("K Desktop Environment");
   // links in the top bar, right
   $menuright = array ('family/'=>'Sitemap',
     'contact/'=>'Contact Us');

Even in the you can already use the i18n-functions, which is important to have the names right on translated pages!

Global Variables setup by

The does some setup of global vars, even before it includes the, these are:

  • $site_root contains the relative path to the toplevel of the current site, like:
 $site_root = "../.."
  • $document_root contains the absolut pathname which is the documentroot of this site, even correct if the site isn't in it's own vhost, example:
 $document_root = "/home/www/sites/www"
  • $url_root contains the absolute baseurl to the toplevel of your site, if your site would for example have a it's toplevel in, like it is for staging, this would contain
 $url_root = /sites/www
 $current_relativeurl = whatiskde/manifest.php

BE AWARE: In former version of the framework it was common to set the $site_root manually before including the, this won't work now, as the will overwrite the $site_root. This should cause no danger, as should find out the right one, but in the long term, all manual definitions should be removed, the global variables exports should be used to replace the usage of the old $site_root.

The framework is clever, it will never add trailing slashs to the $site_root, $document_root and $url_root, therefor they can and must always be used like:

 $some_url = "$site_root/mycoolpage.php"

Configuration Variables

You can set some variables to alter the behaviour of the framework, either global in your or in front of your inclusion in each .php-files.

Useful variables are:

  • The Name for your whole subdomain/site, best set once in
 $site_title = "KDE Foo Site Title";
  • The title of the individual page.
 $page_title = "Page Title";
  • Don't show edit function on the page. The default is $showedit = true;. This setting should normally not be used. is the preferred place.
 $showedit = false;

This page was last edited on 11 March 2016, at 17:48. Content is available under Creative Commons License SA 4.0 unless otherwise noted.