2017 © Pedro Peláez
 

library template

SamsonCMS base template

image

samsoncms/template

SamsonCMS base template

  • Wednesday, January 4, 2017
  • by samsonos
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3,502 Installations
  • CSS
  • 2 Dependents
  • 0 Suggesters
  • 5 Forks
  • 7 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

SamsonCMS generic template module

Latest Stable Version Build Status Code Coverage Scrutinizer Code Quality Total Downloads Stories in Ready, (*1)

This module is responsible for rendering base HTML template, its styles, icons and images., (*2)

All template styles is created with LESS, every entity has it vars.less., (*3)

This module should define HTML structure of SamsonCMS, its building blocks and entities which should be used in all other SamsonCMS modules and applications., (*4)

This template is basic and included in a SamsonCMS bootstrap, but can be easily changed by custom or modified once, the only limitation that must be met is template structure and its events, as all SamsonCMS ecosystem is based on this structure and entities., (*5)

Template is using Font-Awesome for all icons., (*6)

Events

All structure blocks have Events(http://github.com/samsonphp/event), and all their filling and rendering should be done via this events., (*7)

Template structure

This base SamsonCMS template structure can be defined as next: * Menu section .template-menu * Sub-menu section .template-sub-menu * Container section .template-container, (*8)

Template menu structure

Index view is located www/menu/index.vphp, menu item view is located www/menu/item.vphp * <section>.template-menu * <ul>.template-menu-list * <li>.text Added .active if item is active * <a>.item or <div>.item (for .active element as it cannot be clicked) * <i> For icons (do not use it if no icon is needed) * <span> For item text (do not use it if no text is needed), (*9)

Template sub-menu structure

Index view is located www/menu/index.vphp, menu item view is located www/menu/item.vphp * <section>.template-sub-menu * <ul>.template-sub-menu-list * <li>.collapser For showing/hiding sub-menu * <li> You can use any inner item structure, (*10)

This event fires before generic menu rendering process has started. Before menu started default template menu item would be automatically added: * Main page item * Go to site item So in your event you will already receive not an empty menu $html, this gives you ability to remove this default items or change them., (*11)

For rendering sub-menu section you need to fill $submenu in your event handler., (*12)

This event fires when all menu inner items has been rendered into main container., (*13)

This is a modified old approach menu & sub-menu render integrated via new menu events, (*14)

function oldMenuRenderer(&$html, &$subMenu)
{
    // Iterate loaded samson\cms\application
    foreach (\samson\cms\App::loaded() as $app) {
        // Show only visible apps
        if ($app->hide == false) {
            // Render application menu item
            $html .= m('template')
                ->view('menu/item')
                ->active(url()->module == $app->id() ? 'active' : '')
                ->app($app)
                ->icon($app->icon)
                ->name(isset($app->name{0}) ? $app->name : (isset($app->app_name{0}) ? $app->app_name : ''))
                ->output();
        }
    }

    $subMenu = '';

    // Find current SamsonCMS application
    if (\samson\cms\App::find(url()->module, $app/*@var $app App*/)) {
        // Render main-menu application sub-menu
        $subMenu = $app->submenu();

        // If module has sub_menu view - render it
        if ($app->findView('sub_menu')) {
            $subMenu .= $app->view('sub_menu')->output();
        }
    }
}

Template container structure

All elements inside container must be inside .template-block * <section>.template-container * <div>.template-block, (*15)

Template container form structure

  • <*>.template-form Should be used for all forms
    • <div>.template-form-group - Form row
      • <div>.template-form-input - Form input field
        • <input,select,textarea>.template-form-input-field
        • <label>.template-form-input-placeholder Used instead of standard placeholder

Container events

Main page created event - template.main.created

This event fires before main page rendering process has started., (*16)

Main page rendered event - template.main.rendered

This event fires when main page has been rendered into main container., (*17)

The Versions

04/01 2017

dev-master

9999999-dev http://samsonos.com/

SamsonCMS base template

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov

samsoncms template samsoncms structure

17/08 2016

0.0.5

0.0.5.0 http://samsonos.com/

SamsonCMS base template

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov

samsoncms template samsoncms structure

15/08 2016

0.0.4

0.0.4.0 http://samsonos.com/

SamsonCMS base template

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov

samsoncms template samsoncms structure

29/07 2016

0.0.3

0.0.3.0 http://samsonos.com/

SamsonCMS base template

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov

samsoncms template samsoncms structure

29/07 2016

0.0.2

0.0.2.0 http://samsonos.com/

SamsonCMS base template

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov

samsoncms template samsoncms structure

19/07 2016

0.0.1

0.0.1.0 http://samsonos.com/

SamsonCMS base template

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov

samsoncms template samsoncms structure