Documentation
SPHPlayground manual
sphplayground
sphplayground

Introduction to HTML components

The HTML namespace contains basic components to create basically all HTML elements.

SPHPlayground contains also mobile friendly customizable UI components compatibile with most web browsers and devices. Most UI components are based on Bootstrap frontend framework.

The Content interface

All build-in HTML components implement at least Content interface. This ensures that the component can be outputted to an HTML document via the following methods.

This interface has several methods, so it’s usually easier to extend from AbstractContent instead, which sets most of the methods to use typical defaults you can override as needed leaving only the implementation of the getHtml() method as required.

The AbstractContent class gives an implementation to the subsequent two of these methods leaving the implementation of the getHtml() to the inheritor. This ensures that __toString() will never throw any type of Exception during execution.

The Component interface and its AbstractTag implementation

The Component interface declares a group of methods for HTML attribute handling. It is implemented in the abstract class AbstractTag. AbstractTag is the first actual PHP implementation of a HTML tag in the framework. It also defines the tagname property in AbstractTag::__construct().

Lorem ipsum dolor sit amet

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium ipsum non viverra dictum. Etiam scelerisque gravida ullamcorper. Aenean rhoncus a sem in vehicula.

enean elit sem, lacinia non dapibus quis, commodo vel enim. Pellentesque nec interdum dolor. Vestibulum varius suscipit diam eu feugiat. Nam rhoncus nunc in felis egestas elementum.

Mauris pellentesque, elit et pulvinar ornare, dui lacus ullamcorper urna, tincidunt dictum risus tellus non nisi..

Donec tincidunt convallis libero nec sollicitudin. Integer sem nulla, pulvinar laoreet rutrum sit amet, suscipit eget sem. Cras ex orci, fringilla a accumsan at, malesuada sed lorem. Nam eget hendrerit dui..

Aenean vitae commodo mi, non elementum enim. Nulla aliquam pharetra urna..

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium ipsum non viverra dictum. Etiam scelerisque gravida ullamcorper. Aenean rhoncus a sem in vehicula.

enean elit sem, lacinia non dapibus quis, commodo vel enim. Pellentesque nec interdum dolor. Vestibulum varius suscipit diam eu feugiat. Nam rhoncus nunc in felis egestas elementum.

Mauris pellentesque, elit et pulvinar ornare, dui lacus ullamcorper urna, tincidunt dictum risus tellus non nisi..

Donec tincidunt convallis libero nec sollicitudin. Integer sem nulla, pulvinar laoreet rutrum sit amet, suscipit eget sem. Cras ex orci, fringilla a accumsan at, malesuada sed lorem. Nam eget hendrerit dui..

Aenean vitae commodo mi, non elementum enim. Nulla aliquam pharetra urna..

The ContainerComponent declares the properties fot a HTML wrapper element (a tag pair) acting as a container for other elements. It has a implementation ContainerTag in the framework.

Furthermore all actual framework components implement Component

The AbstractTag class

This Abstract class is the base implementation for all predefined HTML tag components.

Note! Use only HTML attributes that are specified for the underlying HTML tag name returned from the method getTagName().

HTML content creation

Classes in this namespace enables the creation of modern HTML documents in object oriented PHP.

Level 2 Heading inside a <section>

Markdown inside a <section>.

Level 3 Heading inside an <article>

This article is nested inside an <section>.

Markdown: A <p> inside an <article>.