Next: Locale

BMC/UUP-SITE - Context

This library was created with large scale web sites in mind where page context is gathered from the file system or system config and used for dynamic construction of i.e. menus. It also supports defining context programatically, making it more suitable for web application development.

The context are collected as object structures by the library and made available for the theme to render as it find most appropriate. The default theme renders standard and sidebar menus combined on the left hand side.

Examples

To fully understand page context you should enable debug output in defaults.site and install the examples:

uup-site.sh --examples

Standard menus (navmenu)

The standard menu appears normally on left hand side. Menus from parent directory gets merged in. The standard menus are available for an page in the $this->navmenu member variable. Use Link::SEPARATOR or false as menu separator. See example/context/menus for more details on menus (i.e. dynamic content replace).

Dynamic defined by standard.menu files in the file system, static defined by system config or programatically by code. When using the file system, files are gathered from current directory and its parent directories (max two levels up).

<?php

use UUP\Site\Page\Web\Component\Link;

return array(
        'head' => _('Header'),
        'data' => array(
                _('Page 1') => 'page1',
                _('Page 2') => 'page2',
                Link::SEPARATOR,
                _('Page 2') => 'page2',
        )
);
System config

Can be static defined or disabled in defaults.site. The default setting is to dynamic build navmenu from files.

Sidebar menus (sidebar)

The sidebar menu might occure on right hand side or merged with the standard menu. An page can programmatically access the $this->sidebar member variable. Use Link::SEPARATOR or false as menu separator. See example/context/menus for more details on menus (i.e. dynamic content replace).

Dynamic defined by sidebar.menu files in the file system, static defined by system config or programatically by code.

<?php

use UUP\Site\Page\Web\Component\Link;

return array(
        _('Sect1') => array(
                _('Link 1') => 'link1',
                _('Link 2') => 'link2'
        ),
        _('Sect2') => array(
                _('Link 3') => 'link3',
                _('Link 4') => 'link4',
                Link::SEPARATOR,
                _('Link 5') => 'link5'
        )
);
System config

Can be static defined or disabled in defaults.site. The default setting is to dynamic build sidebar from files.

Topbar menus (topbar)

The topbar menu links shows up in the main menu on top of page. These are typical the most prominent links and should be only a few. A page can use the $this->topmenu member variable. When rendering the page for mobile devices, these links appears collapsed on right hand side as a popup menu.

Dynamic defined by topbar.menu files in the file system, static defined by system config or programatically by code.

<?php

return array(
        _('Start')   => 'start',
        _('About')   => 'about',
        _('Contact') => 'contact'
);
System config

Can be static defined or disabled in defaults.site. The default setting is to disable the topbar menu.

Custom HTML headers (headers)

Typical used for providing <meta> tags. The top level key defines the element name. For each child array, an element is generated having its key/val pairs as attributes.

Static defined HTML headers (array) or dynamic fetched from headers.inc files in script directory if true. Use false to completely disable.

<?php

return array(
        'meta' => array(
                array(
                        'name'    => 'description',
                        'content' => 'Site and application template system'
                ),
                array(
                        'name'    => 'author',
                        'content' => 'Your name'
                ),
                array(
                        'name'    => 'keywords',
                        'content' => 'php,template,router'
                ),
                array(
                        'http-equiv' => 'Content-Type',
                        'content'    => 'text/html;charset=utf-8'
                )
        )
);
System config

Can be static defined or disabled in defaults.site. The default setting is to disable using header files.

Publisher information (publish)

The publisher contains page responsible information. Publisher information is typical provided site wide from the template directory. The publisher information are available for an page using the $this->publisher member variable.

Static defined in system config. Can be overridden by publish.inc in page directory or template/publish.inc defined for all pages.

<?php

return array(
        "contact" => array(
                "href" => "http://directory.example.com/info/?id=4775",
                "name" => _("Page Responsible")
        ),
        "editor"  => array(
                "href" => "http://www.example.com/webmaster",
                "name" => _("Webmaster")
        ),
        "copying" => sprintf("2017-%s", date('Y')),
        "updated" => getlastmod()
);
System config

Can be static defined or disabled in defaults.site. The default setting is to disable publish information.

Content specification (content)

Content specification file that might appear in directory listings or being used by the index page for an directory. The content is available for pages in the $this->content member variable. Currently, content specification is collected but not presented by the default theme.

Static defined in system config or dynamic fetched from content.spec files.

<?php

return array(
        'name'  => 'Short name',
        'desc'  => 'An longer description text',
        'info'  => 'An short introduction',
        'image' => 'URL for an image, video or audio clip'
);
System config

Can be static defined or disabled in defaults.site. The default setting is to disable content specification.

Examples