×

Website architecture

website-architecture

The main structure of the website:

  • PHP init
  • <head>
    • Meta data
    • JavaScript libraries
    • CSS style sheets
  • <body>
    • header: the headline with menu
    • content: the main page
    • footer: footline
    • execute JavaScript
    • cookie location

Website index.php

Structure of index.php

  • <?php PHP Init
    • _init_page.php
      • masterdata/_init.php
      • session_start()
      • masterdata/BasicFunctions.php
    • masterdata/datadefinitions.php
      • masterdata/class_data_accessclass.php
    • _prepare_head.php
  • <html lang=$domain_language>
    • <head>
      • meta data:
        • $headtitle,$headdescrtiption,...
      • _head.php
      • css/webkit.css
      • _head_js.php
    • <body>
      • Page header with menu
        • _header.php
          • menu
      • Content
        • page
          • home
          • login
          • test
          • activate
        • else
          • HTML: #layout1, #masterdata1, #html1, #edit
      • Page footer
        • js/standard.js
        • _footer.php
          • legal notice, contact
        • _foot_standard.php
        • js/example.js
      • cookie handling

PHP Init

The session, cookies and the data access is handled here. The required ressources like the datadefinitions and pages array are prepared here.

_prepare_head.php

The meta data are perpared in "_prepare_head.php". For "form" and "detail" the meta data are read out of the recordset into the the variable "dataws[0]".

<head>

The meta data, style sheets and JavaScript Libraries are declared here.

<body>

The website is displayed here. The header is filled by _header.php. For the standard elements only some HTML-ids are inserted in the main-tag. The footer is displayed by _footer.php. For the standard elements and some special pages the "example.js" inserts the K8 Web Kit elements into the HTML-ids.

js/example.js

The example.js fill the HTML-id with the standard elements or builds some special pages:

  • standard elements
    • masterdata
    • list
    • form
    • catalog
    • detail
    • lineedit
    • simpledata
    • chartjs
  • special pages
    • register
    • mydata
    • userlist
    • member
    • contact
    • translation
  • GLOBALS_pages_masterdata1, GLOBALS_pages_html1
  • site structure

Datadefinition

Entry Points

Structure parameters of the datadefinition (-- comment --, single stage only):

  • -- PHP --
    • -- meta data fix --
      • headtitle
      • headdescription
      • headimage
    • -- meta data columns --
      • headtitlecolumn
      • headdescriptioncolumn
      • headimagecolumn
    • optionsadditional[]
    • php_include[]: PHP files
  • -- head --
    • head[]: HTML
    • head_include[]: PHP files
    • head_end[]: HTML/JavaScript
    • settingsadditional[]
  • -- body --
    • foot[]: HTML/JavaScript

head[]

Libraires and CSS files are added here.

head_include[]

Variables with database content can be declared here. Please look to the example below.

head_end[]

Before head_end the datadefintion is loaded. In head_end[] the JavaScript of this defintion is added.

foot[]

This array with HTML elements is inserted in the foot area.

The default JavaScript file is: js/example.js. If you have defined your own foot JavaScript file, the "example.js" is not executed. With this parameter the execution is forced:

  • foot_nodefault: false (default:true)

head_include[]

kitsamples/customerlist/customerlist_head_include.php:

The variable "customer_group" is filled with an array of records from the table k8groups.

"$default" is set to true. This forces to load the file 'head_js.php'.

Array pages[]

The array pages[](-- comment --, single stage only):

  • url
  • php_include[]
  • -- head --
    • -- meta data --
      • headtitle
      • headdescription
      • headimage
    • head_include
    • head[]
  • -- body --
    • contentPHP
    • foot_include
    • foot[]
  • -- more paramenters --
    • login
    • helpurl
    • datadefID
    • layout
    • contentfile (load as last, don't use it for an layout!)
    • js_display
    • site

_init_pages.php

The Array pages[] is declared in "_init_pages.php". The ressources of the page are defined by its structure.

contentPHP

The PHP-file "contentPHP" is loaded by the index.php into the main section.

-- meta data --

If a datadefID is set, the meta data are taken from the datadefinition otherwise from the page array.

k8pages.record

Parts of record important for the website structure (-- comment --, single stage only):

  • -- meta data --
    • headtitle
    • headdescription
    • not supported: headimage
    • first image from image array
  • head
  • foot
  • site

The master data form of k8pages is located in the Admin menu.

Sites Entry Points

This is the site[] structue:

  • layout
  • elements[]
    • selector
    • datadefID
    • page
    • datadefinition

Supported entry points of datadefinition:

  • optionsadditional[]
  • php_include[]
  • head[]
  • head_include[]
  • head_end[]
  • settingssadditional[]
  • foot[]

The sites structure can be defined in the pages[] structure and in the k8pages table.