References
- SLS_Generic - Generic Class - Used eveywhere in the application
- SLS_XMLToolbox - Tool SLS_XMLToolbox - XML Treatment
SLS_Generic1 is the main class of SillySmart, is it who provides the interfaces with all other objects, it is the Core’s interface.
At application level, you always have a reference:
$this->_generic;
If ever you need it to other locations (eg static classes), use the Singleton:
SLS_Generic::getInstance();
The set of utilites objects are accessible from SLS_Generic1:
- Object SLS_Session
$this->_generic->getObjectSession();
- Object SLS_HttpRequest
$this->_generic->getObjectHttpRequest();
- Object SLS_Cookie
$this->_generic->getObjectCookie();
- Object SLS_Lang
$this->_generic->getObjectLang();
- Object SLS_Security
$this->_generic->getObjectSecurity();
All these SLS_XMLToolbox2 instances mapping these files are accessible from SLS_Generic1:
- Site.xml
$this->_generic->getSiteXML();
- Mail.xml
$this->_generic->getMailXML();
- Db.xml
$this->_generic->getDbXML();
- Paths.xml
$this->_generic->getPathsXML();
- Project.xml
$this->_generic->getProjectXML();
- Controllers.xml
$this->_generic->getControllersXML();
- Plugins.xml
$this->_generic->getPluginXML();
The set of configurations stored in XML files are accessed from SLS_Generic1:
- Site.xml
$this->_generic->getSiteConfig();
- Mail.xml
$this->_generic->getMailConfig();
- Db.xml
$this->_generic->getDbConfig();
- Paths.xml
$this->_generic->getPathsConfig();
- Project.xml
$this->_generic->getProjectConfig();
All information relating to Actions & Controllers are available from SLS_Generic1:
- To retrieve the generic name of the current controller:
$this->_generic->getGenericControllerName();
- To retrieve the generic name of the current action:
$this->_generic->getGenericScontrollerName();
- To retrieve the unique identifier of the current controller:
$this->_generic->getControllerId();
- To retrieve the unique identifier of the current Action:
$this->_generic->getActionId();
SLS_Generic1 has several functions to form URLs, redirects or dispatch the application.
- To build a complete URL:
$this->_generic->getFullPath($controller, $action, $params=array(), $lang="");
- To redirect on a free URL:
$this->_generic->redirect("http://www.sillysmart.org/");
- To redirect to a Controller / Action:
$this->_generic->forward($controller, $action, $params=array(), $lang="");
- To dispatch Controller / Action without changing the URL :
$this->_generic->dispatch($controller, $action, $params=array());
- To redirect to previous page:
$this->_generic->redirectOnPreviousPage();
SLS_Generic1 allows you to change the current language of the application without worrying about the page that you were through the function the switchLang() function:
$this->_generic->switchLang($lang, $controller="", $action="");
However, you can force a couple Controller / Action if you wish. By default SillySmart retains the current page.
- To retrieve the current template (mapped to the current action):
$this->_generic->getCurrentTpl();
- To dynamically assign a template to the current action :
$this->_generic->setCurrentTpl($templateName);