-
Notifications
You must be signed in to change notification settings - Fork 0
Predefined Constants and Globals
Tsama comes with it's own predefined constants and globals. In some instances these globals will extend the exiting PHP globals.
The two main super globals are $_TSAMA_CONFIG and $_DB
Tsama config is a global array containing a list of Tsama Specific configurations. They are as follows:
- PROTOCOL The protocol whereby the site is being accessed. http or https
- BASEDIR The Base directory of the Tsama instance. This is mostly used for server side coding in especially file handling;
- BASE The Website Base URL. This is mostly used on the client side;
- DOMAIN The Website Domain
- SUBDIR The sub directyory of the Tsama instance, if applicable
- ROUTE The Route for the current service (E.g. service/command/parameter ). For the home this will be empty.
- NAME The site name
- VERSION The Tsama Version
- OUTPUT Tsama Content output. Default is HTML5, options are HTML5, CSS, AJAX, RAW, PNG, JPG
- THEME The site theme. This is normally a directory name under the /themes directory
- LAYOUT The default site layout. This is normally a directory name under the /layouts directory
- PRIMARY_DOMAIN The primary domain. Admin tasks can only be done from this domain. A Value of localhost indicates any domain.
- ALTERNATE_DOMAINS Alternate domains. Optional domains that will be managed by the site.
- USERAGENT The Client's User Agent
- LOGO The default site logo
- COMPRESS Whether output should be compressed. TRUE or FALSE
- HIDE_TSAMA Hide Tsama in output. This normally strip the generator meta tag.
- LANGUAGE The default site language.
- DEBUG Whether to show or hide debug info
The above globals can also be accessed and modified via the Tsama::_conf(key,[optional value]) method.
DB config is a global array containing a list of Database Specific configurations. They are as follows:
- Active Whether a database connection was established or not
- Connection The database connection. E.g. in the case of PDO this will be the PDO class.
- Driver The database driver. Default is mysql
- Host The database host. Default is localhost
- Username The database username.
- Password The database password.
- Name The database name.
To test whether a database is configured, the TsamaDatabase::IsConfigured() method can be used.
To test whether a database is active, the TsamaDatabase::IsActive() method can be used.
For convenience TsamaDatabase will also return the configurations of Driver, Host, Username and Name via the static **TsamaDatabase::**method() e.g. TsamaDatabase::Driver()
Installation and Configuration
Predefined Constants and Globals