SSCK NG demo

SSCK NG (Simple Site Construction Kit NG).

Files

ssckng-album.php
Implement class TSSAlbum that display simple album from folder. Localization are supported if TSSL10n object are provided
ssckng-csvlist-reader.php
Implements the class TSSCsvList that display list from CSV file or array. It supports localization if TSSL10n class are provided.
ssckng-csvtable-reader.php
Implements the class TSSCsvTable that display table from CSV file or array. It supports localization if TSSL10n class are provided
ssckng-file-sender.ph
Implements TSSDownload class to send files in way to used in download server. Caution: in way to implement download server, avoid downloading generic files (for example, permit to download only files on the list) in way to prevent downloading protected files such as php files and alike.
ssckng-html-reader.php
Implements the class TSSHtml to read and display portion of html file enclosed by desirec tag
ssckng-l10n.php
Implements TSSL10n class that is string translation module to implement localization functionality
ssckng-menu.php
Implements TSSMenu class that create navegation elements from json data file or from givem associated array. It supports localization if TSSL10n class are provided
ssckng-page-counter
Provide page access counter class TSSPageCounter that will used to implement own page or download counters.
ssckng-page-gerenator.php
The main class TSSPageGenerator that will used to generate pages. Using confortable config file, will convert static page set in page with navegation menu and alike. The body part of generated page are divided in header contents, navegation contents, main contents, aside contents, and footer contents. Each of this will generated by contents from HTML file, and/or PHP file. The menu (and localization menu, if desired) are stored in json files. Depends on ssckng-l10n.php, ssckng-menu.php, and ssckng-html-reader.php.

Structure of page generated by TSSPageGenerator

The main method is 'Generate()'

"PREAMBLE"
  Prepare L10n module (for localization).
  Execute code from PreamblePhpFile (PHP file) for programming purpose. For example, will load authentication code or alike, or to load more additional translation file (that not specified on config file).

<HEAD>
  'head' part of HeadHtmlFile (HTML file)
  dynamic generated contents (head elements) from HeaderPhpFile (PHP file)

  additioal CSS url from HeaderCssUrl
  title from PageTitle

</HEAD>

<BODY>
<HEADER id="HeaderContents">
  'header' part from HeaderContentsHtmlFile (HTML file)
  (if HeaderContentsHtmlFile is true, get from HeadHtmlFile)
  dynamic generated contents from HeaderContentsPhpFile (PHP file)
</HEADER>
<NAV id="L10nSelectionContents">
  Menu generated from L10nMenuFile (JSON text file)
  dynamic generated contents (like dynamic menu) from L10nMenuPhpFile (PHP file)
  Remark: If L10nLangOptionName is empty, avoid this item from page.
  Remark: If L10nSelectionOnTop === true, place these before 'Header Contents'
</NAV>
<NAV id="NavegationContents">
  Menu generated from MenuFile (JSON text file)
  dynamic generated contents (like dynamic menu) from MenuPhpFile (PHP file)
</NAV>
<MAIN id="MainContents">
  'main' part of MainContentsHtmlFile (HTML file)
  dynamic contents generated by MainContentsPhpFile (PHP file)
</MAIN>
<ASIDE id="ASideContents">
  'aside' part (first occurrence) of ASideContentsHtmlFile (HTML file)
  dynamic contents generated by AsideContentsPhpFile (PHP file)
</ASIDE>
  Remark: If ASideBeforeMain === true, place these before MainContents
<NAV id="BottomNavegationContents">
  Menu generated from BottomMenuFile (JSON text file)
  dynamic generated contents (like dynamic menu) from BottomMenuPhpFile (PHP file)
</NAV>
<FOOTER id="FooterContents">
  'footer' part from FooterContentsHtmlFile (HTML file)
  dynamic generated contents from FooterContentsPhpFile (PHP file)
</FOOTER>
</BODY>


Config file for TSSPageGenerator

The config file is an JSON file with same name as script file, placed in same folder as scipt file.

The variables for config file:

Note that, the variable 'Foo' inside class are 'FFoo' (precceded by 'F'). Thus, '$this->GetFoo()' take the value of '$this->FFoo', specified in the config file as 'Foo'. This rule are applyed for other classes too.

ContentsFolder
Assuem that json file, html file, and php file are stored here.
L10nFolder
If desire to store localization files (translation files and translated html files) in place different of 'ContentsFolder' folder, set this.
HtmlFileExtension
Default extensions for html file
JsonFileExtension
Default extensions for json file
PhpFileExtension
Default extensions for php file
UseHtml4ForInput
If true, header contents, main contents, aside contents, and footer contents are portion of html file, enclosed by 'body' tag, instead of their respective tags.
PreamblePhpFile
This file is loaded before at very first time (before start generation page). Use it to check if user are authenticated to access the page, etc. Note that L10n module are prepared before this point.
HeadHtmlFile
Head part of this HTML file are used to generate page head
HeadPhpFile
Dynamic generated contents with this php file are inserted into page head
PageTitle
If present, set this as page title
HeadCssUrl
string (url for single css file) or array of string (url's for multiple css files)
CssUrlPrefix
If true (default), assume value of ContentsFolder. If not empty, css that is not absolute url are relative to CssUrlPrefrix.
BodyOptions
If not empty, passe it to 'body' tag
Title
Title of contents, placed in 'header'. If true, assume same as PageTitle
TitleEnclosure
Enclosure tag for 'Title', to format using css
TitleOptions
If not empty, passed to 'TitleEnclosure' tag
HeaderContentsOptions
If not empty, is passed to 'header' tag
HeaderContentsHtmlFile
'header' part of this file are used for contents of 'header'
HeaderContentsPhpFile
Dynamic contents generated by this php file are inserted into 'header'
L10nSelectionContentsOptions
If not empty, are passe to 'nav' tag of 'L10nSelection'
L10nSelectionOnTop
If true, 'L10nSelection' menu became before 'header'
L10nLangOptionName
If non-empty, enable 'L10nSelection' menu. This name are used to pass language code from one page to other by GET method. If empty, 'L10nSelectionContents' (langauge menu) are not generated
L10nMenuToagle
If true, generate menu toagle code, if toagle parameter are specificied in menu file.
L10nMenuType
Type of menu: 'ul', 'ol', 'div', or 'span'
L10nMenuId
Id for tag specificied in 'L10nMenuType', needed when 'L10nMenuToagle' is true. Will used to format 'L10nSelection' menu using css too.
L10nMenuOptions
If not empty, are passed to tag specificied in 'L10nMenuType'
L10nCurrentLang
Id (language code) for locatlization module (L10n) and language selection menu. Their value are obtained automatically from language code set on variable (of name not given in L10nLangOptionName) from URL (GET method), or if it not present, take value from field (with name given in L10nLangOptionName) on config file. If it not present too, keep value set here (thus, normally, keep unset).
L10nMenuFile
JSON file that contain specification of L10NSelection menu
L10nMenuPhpFile
Dynamic generated cintents from this php file are included insde 'nav' corresponding to L10nSelection menu.
NavegationContentsOptions
If not empty, are passe to 'nav' tag of navegation menu
MenuToagle
If true, generate menu toagle code, if toagle parameter are specificied in menu file.
MenuType
Type of menu: 'ul', 'ol', 'div', or 'span'
MenuId
Id for tag specificied in 'MenuType', needed when 'MenuToagle' is true. Will used to format navegation menu using css too.
MenuOptions
If not empty, are passed to tag specificied in 'MenuType'
SubMenuOptions
If not empty, are passed to tag specificied in 'MenuType' for sub menus.
MenuDisabledItem
item, or list of itens (if sub menu), that disable from menu
MenuFile
JSON file that contain specification of navegation menu
MenuPhpFile
Dynamic generated cintents from this php file are included insde 'nav' corresponding to navegation menu.
MainContentsOptions
If not empty, are passed to 'main' tag
MainContentsHtmlFile
The contents enclosed by 'main' tag of this html file are used to 'MainContents' part of page
MainContentsPhpFile
The dynamic generated contents from this php file are inserted into 'MainContents'.
ASideBeforeMain
If true, place 'ASideContents' before 'MainContents'.
ASideContentsOptions
If not empty, are passed to 'aside' tag
ASideContentsHtmlFile
The contents enclosed by first 'aside' tag of this html file are used to aside contents part
ASideContentsPhpFile
Gynamic generated contenst by this pho file are inserted into aside contens
BottomNavegationContentsOptions
If not empty, are passe to 'nav' tag of bottom navegation menu
BottomMenuToagle
If true, generate menu toagle code, if toagle parameter are specificied in menu file.
BottomMenuType
Type of menu: 'ul', 'ol', 'div', or 'span'
BottomMenuId
Id for tag specificied in 'BottomMenuType', needed when 'BottomMenuToagle' is true. Will used to format bottom menu using css too.
BottomMenuOptions
If not empty, are passed to tag specificied in 'BottomMenuType'
BottomSubMenuOptions
If not empty, are passed to tag specificied in 'BottomMenuType' for sub menus.
BottomMenuDisabledItem
item, or list of itens (if sub menu), that disable from bottom menu
BottomMenuFile
JSON file that contain specification of bottom navegation menu
BottomMenuPhpFile
Dynamic generated cintents from this php file are included insde 'nav' corresponding to bottom navegation menu.
FooterContentsOptions
If not empty, are passed to 'footer' tag
FooterContentsHtmlFile
The contents enclosed by first 'footer' tag of this html file are used to footer contents part
FooterContentsPhpFile
The dynamic generated contents from this php file are inserted in footer contents part
L10nFile
Main localization json file, or list of files, for localization. Note that, after this files, perform search for json file with same name as script file to add over. If necessary, $this->FL10n is the localization class that will by used inside included php files.

Some remarks on TSSCKPageGenerator

Other modules

The modules that will be used with ou without SSCKPageGenerator.

TSSAlbum

This class will used to display simple autogenerated picture/movie album from folder. The main method is 'Generate()', with ptional argument that is the album title. For pictures inside subfolders, the subfolder name are used as title for set. If L10n are set, apply 'FL10n->str()' to perform localization. In way to generate album's thumbnails on linux, use mkthumb.sh from 'tool' folder.

Variables

Folder
Root folder that contains picture/movies. The 'Generate()' method scan for this folder and their sub folders.
Options
If not empty, are used as options for album title tag '<h3>'
AlbumEnclosureTag
If not empty, use to enclosure Album and subalbum (block inside subfolders)
AlbumOptions
Options for tag specified in AlbumEnclosureTag for entire album.
SubAlbumOptions
Options for tag specified in AlbumEnclosureTag for subalbuns (block inside each subfolders).
ImageExtensions
List of allowed extensions for pictures
MovieExtensions
List of allowed extensions for movies
ImageOptions
If not empty, used as options for '<img>' tag for picture thumbnail.
MovieOptions
If not empty, used as options for '$lt;img>' tag for movie thumbnail.
ImageUrlOptions
If not empty, used as options for '<a>' tag for picture target.
MovieUrlOptions
If not empty, used as options for '$lt;a>' tag for movie target.
MovieAfterThumbOptions
Options for 'span' tag that succed 'img' tag for movie thumbnail for css formating purpose (like overload 'play' icon.
ThumbFolder
Set it, if want to use thumbnail root folder different than album root folder. If false, use same root folder as album.
ThumbSubFolder
Subfolder to store thumbnails. Recomended to set, if ThumbFolder is false
ThumbPrefix
Thumbnail file name prefix to differentiate from image/movie files
ThumbPostfix
Thumbnail file name postfix to differentiate from image/movie files
ThumbDisplayWidth
Thumbnail file width. Recomended to set if not all files have thumbnails
L10n
Localization module that implements 'str()'method to translate string. If is not null, will perform translation of album title

TSSCsvListReader

This class will used to generate list from csv files by method 'Read()' (or givem array, by method 'Print()').

Variables

FileName
CSV File name to generate list
Separator
Column separator for csv file. Usually, colon or semi-colon.
Enclosure
Column enclosure for csv file. Usually, double quote
TrimmingChars
Skipping white chars before column element. Usually, empty
OnlyEmptyItemsIsEmptyRow
If all column element is empty, assume as empty row (that separate one list with other)
Type
Type of list that will be 'ul', 'ol', or 'dl'.
HeadFragmentEnclosureTag
Tag used to enclosure first fragment (first column on csv file) of item.Normally, 'span'.
HeadFragmentOptions
If not empty, is used to opton for Tag specified in 'FirstFragmentEnclosureTag' (for type 'dl, for tag 'dt'.
TailFragmentEnclosureTag
Tag used to enclosure tail fragment (column on csv file, except first column) of item. Normally, 'span'.
TailFragmentOptions
If not empty, is used to opton for Tag specified in 'TailFragmentEnclosureTag' (for type 'dl, for tag 'dd'.
FragmentSeparator
Inserted between fragments (column on csv file) for tail parts (except first column parts). If HeadFragmentEnclosureTag is empty, are inserted between first and second ones too. Normally space.
Link
If true, (2i+1)-th column on csv file (if not empty) are url of (2i)-th fragment ( (2i)-th column on csv file).
LinkPrefix
This string are prefied on all url's that is not absolute url, if Link is true.
NumBlocks
Number of blocks to read. Assume that empty row separate one block to other
CommentMark
Is not empty, all lines started by this char are skiped (comment). Note that this char need to became first char to be considered as comment. If enclosured by double quots or like, or preceded by space, are not considered comment line.
L10n
Localization module that implements 'str()'method to translate string. If is not null, will perform translation on some fragmentto fo list.
TranslateFirstFragment
Translate first fragment (column of csv) for all list item (row of csv file)
TranslateAllFragment
If true, translate all fragment, instead of first fragment.

TSSCsvTableReader

This class will used to generate table from csv files by method 'Read()' (or givem array, by method 'Print()').

Variables

FileName
CSV File name to generate table
Separator
Column separator. Usually, colon or semi-colon.
Enclosure
Column enclosure. Usually, double quote
RowSeparator
Row separator. Usually, new line
TrimmingChars
Skipping white chars before column element. Usually, empty
OnlyEmptyItemsIsEmptyRow
If all column element is empty, assume as empty row (that separate one table with other)
ContentsOnly
If true, read and generate table row, withouth 'table' and 'tbody' tag. Used to complement existing tables. On the read, skip head row and footer row, if exists (for print from array, skip head row and footer row too).
SkipHeadRow
If true, skip readding table read row (first ones)
FootRow
If true, assume that last row is table foot
SkipFootRow
If true, skip readding table foot row (last ones)
NumBlocks
Number of blocks to read. Assume that empty row separate one block to other
CommentMark
Is not empty, all lines started by this char are skiped (comment). Note that this char need to became first char to be considered as comment. If enclosured by double quots or like, or preceded by space, are not considered comment line.
Caption
Used as table caption, if not empty
L10n
Localization module that implements 'str()'method to translate string. If is not null, will perform translation on table head (and table caption)
TranslateFirstColumn
Translate first column of table foot
TranslateAllFirstColumn
If true, translate first column of all row.

TSSFileSender

This class provides method to implement download server. Main method is 'Send()', but header and file itself will sended separatelly by 'SendHead()' and 'SendFile()'. Caution to implement download server because, if not filtered, will download sensible files like php files. Thus, download server need to use file list and permit download only files that are in the list.

Variables

BufferSize
Size of block size to read each time.
DefaultCType
ctype that assumed as default, when not detectable by file extension

TSSHtmlReader

This class provides method to read part of html file enclosed by given tag. Each portion enclosed by tag are asumed one block. It support nested tags (like list inside lists, span inside span, etc). Main method is 'Read()'.

Variables

FileName
input HTML file name
KeepCommment
If true, read comment too (if false, skip comment).
ContentsOnly
If false, read tag+(tag options) too.
NumBlocks
Number of blocks to read

TSSL10n

This class provides method to translate string for localization. The translation are loaded from json files. Use 'SetFromFile()'/'AddFromFile()' to load translations from file, and use 'str()' to translate string. The 'PreferedLang()' will be usefull to detect client side (browser) prefered language.

Variables

AppName
Name of app
AppVersion
Version of app
LangName
target language name to be translated
LangCode
target language code to be translated

TSSMenu

This class provides method to generate menu from json file using 'AddFromFile() (or from array using 'Add()'). Them main method to generate menu is 'Print()'. If L10n module are provided, translate the menu.

Variables

Id
Id for menu, needed if use toagle menu
Options
If not empty, passed to menu enclosure tag
SubMenuOptions
If not emty, passed to submenu tag options
Toagle
If true, process menu toagle elements specified inside json file (or array). If false, toagle element are skiped on menu generations
PrefixTagOptions
If not empty and menu prerfix is present on menu of file (or array), pass as option to menu prefix enclosure tag
SubMenuPrefixTagOptions
If not empty and menu prefix is present on bubmenu of file (or array), pass as option to menu prefix enclosure tag of submenu.
ItemSeparator
Inserted between one item to other, mainly for pretty print purpose
DisabledItem
The item that are considered disabled (current item, that marked as 'disabled'). If item of submenu, need to pass list of sequence of itens (previews itens, and current itens) to mark sucessivelly (the preview ones are marked as disabled, but the item that are list of single element instead of string, are marked as selected -- and keep url alive -- ).
EnabledItemTagOptions
If non empty, are passed as options for item marked as enabled, in way to used by css for formating
DisabledItemTagOptions
If non empty, are passed as options for item marked as disabled
SelectedItemTagOptions
If non empty, are passed as options for item marked as selected (in way to mark as selected, specify in list of 'DisabledItem', as list with single element, instead of string)
L10n
Translation module. If not null, take the localization using 'FL10n->str()' to translate menu
UseUrl
Default option is true that assume use of URL for menu, instead of javascript code.
UrlParam
The 'key'=>'value' elements of this list are passed as 'key=value' for all url of menu (as GET method)

TSSPageCounter

This class provides method to count the page access, using json files. In way to work, json file need write permissions for web server (like apache). If file are not present, their folder need write permission to create ones). The main method is 'Step()'.

Variables

File
Counter json file name. It will passed as first parameter on new instance, but will changed after
Id
Id used as counter inside json file. It will passed as first parameter for 'Step()', but will set it and call 'Step()' without parameter.
AutoAdd
If true, the counter that is not found in the file are created and initialized as 1.
UnknownId
If counter Id are not specified, use this id to perform access counting

License

All files, except photos and video, are distributed as GNU GPL version 3, or (at your option) any later version.

https://opensource.org/licenses/gpl-license

License for photo e video

All photos and video included as samples for album, are authorship of Sadao Massago, and distributed as CC BY-NC 4.0.

https://creativecommons.org/licenses/by-nc/4.0/