Guide: Sections

tracend edited this page Oct 30, 2012 · 14 revisions

This is a basic introduction of what sections are and how you can create your own.

Sections are defined form TYPE::FORMAT which seems to simplify the logic. The first part states the name of the section class we want to use and defines the content type while the second part the format we want to use to output the data.


<? Menu::ul() ?>


Here is a list of the sections that are included with the KISSCMS distribution.

  • _Menu : Selects a list of pages using the Page() model

  • Search : Creates a site search field querying Google search

  • Archive : Displays the months of the dates pages were created

  • Tags : Displays a list of all the used tags on pages (excluding selected exceptions)

  • LatestUpdates

You can include more section types with plugins or your own custom coding.


There are a number of formats available in KISSCMS by default and you can extend that with your own. the main are

  • ul : Display content in a ul list
  • inline : Display content inline


Each view, ul(), inline() and others can support a number of attributes. Each presentation may have special support of attributes but the main ones mostly supported are:

  • id : The id name of the enclosing section
  • class : The class name of the enclosing section
  • h3 : The string for the title
  • h3-id : The id of the title
  • h3-class : The class of the title
  • ul-id : The id of the list (if available)
  • ul-class : The class of the list (if available)
  • delimiter : A string that separates items (especially when presented inline )
  • tag : Limit the items based on a specific tag

These attributes are used in a pseudo-object form, for example:

Menu::ul("tag: menu-top, title: Menu");

Will display a menu list in a ul list with the title "Menu"

Note that sections are always wrapped with a section wrapper: <section>...</section>


You can include any number of new sections that you code yourself. All that required is that you extend the base Section() class and call the render() method to display the output. Example for a NewSection() class we'll need the followwinf barebone structure:

	class NewSection extends Section {
		function __construct($view=false, $vars=false, $data=false){
			$this->data['items'] = $this->getData();
		function getData(){
			// custom code to get data...

This can be simplified even further if we don't want to resource dynamic data (perhaps just pass some 'static' data), for example when creating panels - like this dashboard:

class Dashboard extends Section { 

	function __construct($view=false, $vars=false, $data=false){
		$this->data = $data;