[Cs-content-commits] SF.net SVN: cs-content:[377] trunk/1.0/cs_genericPage.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-05-15 15:21:17
|
Revision: 377 http://cs-content.svn.sourceforge.net/cs-content/?rev=377&view=rev Author: crazedsanity Date: 2009-05-15 15:21:15 +0000 (Fri, 15 May 2009) Log Message: ----------- Require SITE_ROOT constant (like contentSystem). /cs-content/cs_genericPage.class.php: * initialize_locals(): -- require SITE_ROOT to be a defined constant -- set tmplDir and libDir off those vars -- NOTE::: should tmplDir and libDir first check for constants??? Modified Paths: -------------- trunk/1.0/cs_genericPage.class.php Modified: trunk/1.0/cs_genericPage.class.php =================================================================== --- trunk/1.0/cs_genericPage.class.php 2009-05-06 19:30:00 UTC (rev 376) +++ trunk/1.0/cs_genericPage.class.php 2009-05-15 15:21:15 UTC (rev 377) @@ -72,16 +72,13 @@ } - if(strlen(dirname($mainTemplateFile)) && dirname($mainTemplateFile) !== '/' && !preg_match('/^\./', dirname($mainTemplateFile))) { - $this->tmplDir = dirname($mainTemplateFile); - $this->siteRoot = preg_replace('/\/templates$/', '', $this->tmplDir); + if(defined('SITE_ROOT')) { + $this->siteRoot = constant('SITE_ROOT'); } else { - //NOTE: this **requires** that the global variable "SITE_ROOT" is already set. - $this->siteRoot = preg_replace('/\/public_html/', '', $_SERVER['DOCUMENT_ROOT']); - $this->siteRoot = preg_replace('/\/htdocs/', '', $_SERVER['DOCUMENT_ROOT']); - $this->tmplDir = $this->siteRoot .'/templates'; + throw new exception(__METHOD__ .": required constant 'SITE_ROOT' not set"); } + $this->tmplDir = $this->siteRoot .'/templates'; $this->libDir = $this->siteRoot .'/lib'; //if there have been some global template vars (or files) set, read 'em in here. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |