08.13
php
saved
olleolleolle
Note
AppController method to run during beforeFilter(), to give "microsites" -- different styling to the website. Styling info is saved as an array in Session, under the key MicroSite.microsite
AppController method to run during beforeFilter(), to give "microsites" -- different styling to the website. Styling info is saved as an array in Session, under the key MicroSite.microsite
- /**
- * check the URL for 'microsite=kulturliv'.
- *
- * Set the microSite variables with Microsite data.
- *
- * @return void
- * @author Olle Jonsson
- */
- function _checkMicroSiteness() {
- $microSiteName = requestValue('microsite', false);
- if ($microSiteName === false) {
- $microSiteData = $this->Session->read('MicroSite.microsite');
- } else {
- // Look up that keyname, and save it in Session, if successful
- $db =& ConnectionManager::getDataSource('default');
- $result = $db->one("SELECT * FROM microsites WHERE name = " . $db->value($microSiteName) . ";");
- $microSiteData = arrayGet($result, 'microsites', false);
- $this->Session->write('MicroSite.microsite', $microSiteData);
- }
- }
- # Got nothing in QS and had nothing in Session.
- # OR
- # Lookup of Microsite failed.
- # ...so go to the "vanilla" website instead
- $this->_emptyMicrositeData();
- } else {
- $this->set('microSite', $microSiteData);
- }
- }
- function _emptyMicrositeData() {
- $this->Session->del('MicroSite.microsite');
- }
Parsed in 0.056 seconds, using GeSHi 1.0.7.14