2. Overview
Objective
Learn how to configure the system through the xml file.
Requirements
Understanding of the Defines.
Estimated Time
5 minutes
www.prodigyview.com
3. Follow Along With A Code
Example
1. 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
4. XML File
ProdigyView uses an xml file for holding system configurations instead of the standard
PHP 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.ini
2. Database
3. Php file
4. XML File
Out of those 4 ways and test performed with repeated reading of a configuration
file, retrieving a configuration from the database is the slowest, php.ini is faster the a
php file, and an xml file takes the cake.
5. Good Article To Read
A good article to read on PHP configuration files is here:
http://www.phpro.org/articles/Application-Configuration.html
The article will give you insight on using php.ini
configuration, xml configuration, php file configuration, and
the database configuration.
6. How the Configuration Works
The configuration works in two parts
1. 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. PVTemplate
2. 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.
7. General Configuration
The general configuration is general information about the
web application and is mainly used by functions in
PVTemplate.
8. 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
9. System
The system configuration controls how the system runs.
Display Error Message The level of errors to report
Log errors
Remove global
variables
Forces SEO friendly urls
10. Session
The session configuration can be used to control
sessions.
Sessions stored on the server configuration
Cookies stored in the browser configuration
11. Session Review
1. The default configuration file is set by the PV_CONFIG
file
2. 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.