Holds site configuration data; this is separate to and does not override the system level settings. SiteConfig is used to fetch the controller map for the current site and request.
There are two types of parameter that exist within an mvcSiteConfig:
Site specific are, as the name implies, specific to the site that is being requested. These settings cannot be inherited as they govern things like the active controllers (controllerMap.xml file), whether the site is active or not, the template engine in use (usually smarty) and the default Controller to be called for the site if not using the globally set default.
Inherited values can be inherited from a parent site, or a parent parents site or a parent parent p... Yes, if a value cannot be located, it will be passed on and on down the chain until the chain runs out. This allows for lots of very similar sites with only cosmetic differences to have the same config for things like databases, plugins etc. In fact, even the theme can be shared.
When adding additional configuration parameters it is therefore important to consider where they will be used and if the site that is being built will be extended to another site in the future.
$oSiteConfig = mvcSiteConfig::getInstance();
$oSiteConfig->load('/path/to/my/config.xml');
$oSiteConfig->setSitePath(dirname('/path/to/my/config.xml');
$oSiteConfig->getTemplateEngine();
$oSiteConfig->getParentParam('a param that might exist in a parent site');
$oSiteConfig->getParam('my local site param');
public static getInstance()
Returns an instance of the mvcSiteConfig
public reset()
Reset config object
public getSitePath()
Returns site path, the fully resolved path to the sites folder
public setSitePath($inPath)
Set site path
public getFilePath($inFile)
Returns the full path to $inFile in relation to the websites folder
public getTemplateEngine()
Returns the template engine to be used by this site
public getControllerMapFilename()
Returns the filename for the controllerMap file; returns a STRING and NOT the param object
public getControllerMapFile()
Returns the controller map file
public getDefaultController()
Returns the default controller for the site
public getSiteLogLevel()
Returns the site specific loglevel
public isActive()
Returns if the site is active or not (from the config file), defaults to false
public getErrorController()
Returns the site configured error controller, or the parents error controller
public getParentSite()
Returns parent site name if set
public getTheme()
Returns theme to apply to site
public getUriTextSeparator()
Returns the character to use to separate a text string e.g. "this is the text" => "this_is_the_text"
public isCaptchaRequiredOnLogin()
Returns true if the Captcha system should be used for logins
public isAutoloadCacheEnabled()
Returns if the autoload cache should auto-loaded on mvcAutoload init, default true
public isAutoloadCacheAutoSaveEnabled()
Returns if the autoload cache should auto-save on script exit, default true
public getAlwaysLoadSiteClasses()
Returns if the site classes should always be parsed by mvcAutoload, default true
public isI18nActive()
Returns true if multi-languages are enabled
public getI18nIndentifier()
Returns the identifier for marking up / identifying text to be translated
public getI18nDefaultLanguage()
Returns the default language to be used if none is specified
public getI18nAdaptor()
Returns the adaptor to be used for translating text (must be a valid translateAdaptor)
public getI18nAdaptorOptions()
Returns the adaptor configuration parameters
Configuration parameters should be specified as key=value pairs separated with a pipe | character. e.g. disableNotices=true|scan=directory will be converted to an array containing disableNotices => true, scan => directory.
public getParentParam($inSection, $inParam)
Returns the param from the parent site config
public getSiteClasses()
Returns the configured site classes for this site, returns a SECTION and NOT a param
public getParentSection($inSection)
Fetches a section and populates it with the config chains values
public getControllerMapper()
Fetches the controller map; loading it if not set
public getParentConfig()
Return ParentConfig, if there is one to get
public getServerName()
Returns $_ServerName
public setServerName($inServerName)
Set $_ServerName to $inServerName
Posted by: Scorpio Documentor (Writer), in MVC on 02 Dec 2008 @ 21:31
Tags: mvc, mvcsiteconfig, systemconfigbase,
This
work is licenced under a
Creative Commons Licence.