ShineISP is ready to "inject" new modules, services and much more to increase the number of features. So if you would like to add a new feature, clone it, add your module and share it. If the module is well written we will include it in our next release.
For instance we can analize this module: Admin Open this file:
This is only a simple html file. You can edit it to add a new link or change the layout style.
echo $this->doctype(); <html lang="en"> <head> <meta charset="utf-8"> echo $this->partial('partial/admin-head.phtml'); </head> <body> echo $this->partial('partial/admin-header.phtml'); <div class="container-fluid"> <div class="row"> <div class="col-lg-12"> echo $this->flashMessage(); echo $this->content; </div> </div> </div> echo $this->inlineScript(); </body> </html>
Doctype can be changed by code but in order to print it you have to use:
The partials are a snipped of html code or html that you split in various files. In order to read them you have to call them in this way:
In this way you call a file within the module, in this case the admin module, in this path:
A helper is simply a class that implements the interface Zend\View\Helper. Helper simply defines two methods, setView(), which accepts a Zend\View\Renderer instance/implementation, and getView(), used to retrieve that instance. Zend\View\PhpRenderer composes a plugin broker, allowing you to retrieve helpers, and also provides some method overloading capabilities that allow proxying method calls to helpers.
In this case the flashMessage view helper shows a message before the body content. This is the syntax:
If you need to add a new CSS file in your layout template you have to add a new item within the Module.php in this way:
$headLink = $sm->get('viewhelpermanager')->get('headLink'); $headLink->appendStylesheet('/css/admin/bootstrap-switch.css', 'all') ->appendStylesheet('/css/admin/bootstrap-typeahead.css', 'all') ->appendStylesheet('/css/admin/admin.css', 'all');
then in the partial file or in the layout file you have to use the headLink helper:
echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico'))
$inlineScript = $sm->get('viewhelpermanager')->get('inlineScript'); $inlineScript->appendFile('/js/admin/bootstrap-hogan-2.0.0.js') ->appendFile('/js/admin/bootstrap-typeahead.min.js') ->appendFile('/js/admin/bootstrap-switch.min.js') ->appendFile('/js/admin/admin.js');
Then in your layout you have to call the helper inlineScript() in this way: