Recommend this page to a friend! |
Classes of Jorge Castro | DashOne | README.md | Download |
|
DownloadDashOneA minimalist dashboard /backend library for PHP This library allows to create a fast dashboard with the basic features without any template and only using code. In the examples, we create a page for a dashboard in less than 80 lines of code ( examples/test.php ) Example ( examples/test.php ): Another example ( examples/test.php ): Getting startedInstall via composer > composer require eftec/dashone Create a new object DashOne (you will need to add the required include, via autoload.php or manually) > $dash=new DashOne(); And you could render a page using the object of the class DashOne()
ClassesDashOneIt is the main class that generates the dashboard. > $dash=new DashOne(); It is possible to add new elements using fluent interface (chain methods each one). Example: It renders an empty page
Example using fluent
Where the method head is required to render the < head > of the page. The footer is also required to close all the tags. And every chain of methods must end with the method render() (it draw the page).
Method DashOne->head($title,$extrahtml)It renders the head of the page. This element is required > $dash->head('Example - test 1'); Method DashOne->menuUpper($leftControls=[],$rightControls=[])It renders the upper menu of the dashboard. > $dash->menuUpper([new ImageOne('https://via.placeholder.com/32x32')," - ",new LinkOne('Cocacola','#')]); AlertOneIt renders an alert > new AlertOne($title,$content,$class); Example:
ButtonOneIt renders a button > new ButtonOne('button1','Click me','btn btn-primary'); You could use the method buttons (DashOne) to render a button (or buttons). The method has a second argument to determine if the buttons must be aligned or not with the form.
> $dash->buttons($buttons,true) > $dash->buttons($buttons,false) ContainerOneIt renders a container where it is possible to add other elements (such as buttons) > new ContainerOne($html); Example:
The method container() but be followed by a visual method. This method is added inside the container (where it says %control) Another example:
FormOneIt renders a form. It requires a declarative array. If it sets a definition, then it uses the definition to define the types of input objects (textbox,textarea,etc.) If a field of the definition has an array then it is used to render a dropdownitem If it doesn't have a definition then, it uses the values to define the types of input objects (textboxes,textareas,etc.) You could also render a message (for example for warning or information) You could draw a form using an associative array. By default, every field will be a textbox
Or you could explicit the type of field
UlOneIt draws a list (unsorted list)
ImageOneIt draws a image > new ImageOne('https://via.placeholder.com/32x32'); LinkOneIt draws a hyperlink The first value is the name of the link, the second is the address. And the third value (optional), it's a icon (using the classes of Font-Awesome) > new LinkOne('Cocacola','#','far fa-star') > $dash->link('Cocacola','#','far fa-star') TableOneit renders a table.
A basic page :Any pages requires at least to call the head(), footer() and Render(). Render() draws the page so it must be called at the end of the chain. For example, a basic page is as follow:
An empty dashboard:
Version
CopyrightCopyright Jorge Patricio Castro Castillo <jcastro arroba eftec dot cl> Dual License (LGPL v3 and Commercial License) You could use in commercial / close source product or service while In a nutshell (it is the license):
|