OverviewObjectiveLearn how to configure the system through the xml file.Requirements Understanding of the Defines.Estimated Time5 minutes www.prodigyview.com
Follow Along With A Code Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to config/site_config.xml www.prodigyview.com
XML FileProdigyView uses an xml file for holding system configurations instead of the standardPHP file. If you remember reading about the Defines, the location of this file is set there. WHY XML?There a typically four ways of storing and reading configuration files in PHP.1. Php.ini2. Database3. Php file4. XML FileOut of those 4 ways and test performed with repeated reading of a configurationfile, retrieving a configuration from the database is the slowest, php.ini is faster the aphp file, and an xml file takes the cake.
Good Article To ReadA good article to read on PHP configuration files is here: http://www.phpro.org/articles/Application-Configuration.htmlThe article will give you insight on using php.iniconfiguration, xml configuration, php file configuration, andthe database configuration.
How the Configuration WorksThe configuration works in two parts1. If you noticed on the tutorial about the bootstrap, the ‘load_configuration’ option was set to false. If that is set true, the xml file is loaded and those variables are used to initialize: 1. PVSessions 2. PVRouter 3. PVDatabase 4. PVSecurity 5. PVTemplate2. In PVConfiguration, there are various methods that use the xml configuration. Example: Methods such as PVConfiguration::getEmailSettings() retrieve the email settings from the xml file.
General ConfigurationThe general configuration is general information about theweb application and is mainly used by functions inPVTemplate.
Email Configuration The email configuration sets the defaults to how emails will be sent. The most important option here is the ‘mailer’. If the option is set to php, the method PVMail::sendEmail() will send an email using php’s mail() function. If the option is set to smtp, the PVMail:sendEmail() will send an email through SMTP.Default SMTP information used Default from email used in sendmail
System The system configuration controls how the system runs. Display Error Message The level of errors to report Log errorsRemove globalvariables Forces SEO friendly urls
Session The session configuration can be used to control sessions.Sessions stored on the server configurationCookies stored in the browser configuration
Session Review1. The default configuration file is set by the PV_CONFIG file2. The XML file DOES NOT have to be used and can be turned off in the bootstrap.3. The ‘email’ configurations configures the PVMail class.4. The ‘sessions’ configurations configures the Session class.5. The ‘system’ configuration configures the router and error reporting.