[Cs-content-commits] SF.net SVN: cs-content:[380] releases/1.0/contentSystem.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
|
From: <cra...@us...> - 2009-05-27 04:54:39
|
Revision: 380
http://cs-content.svn.sourceforge.net/cs-content/?rev=380&view=rev
Author: crazedsanity
Date: 2009-05-27 04:54:31 +0000 (Wed, 27 May 2009)
Log Message:
-----------
Fix problem where includes/content/index.inc wasn't loaded for the "/" URL.
/contentSystem.class.php:
* prepare():
-- sets the internal "finalSection" variable as the last element in
the internal sectionArr (previously, it would be set as the last
accessible directory in the includes directory).
-- NOTE: finalSection was moved here because otherwise it was created
too late for use in load_includes().
-- NOTE2: if the internal sectionArr is empty, it will now throw an
exception...
* validate_page():
-- no longer sets the internal finalSection value.
* load_includes():
-- when considering inclusion of index.inc, has extra checks to allow
it if finalSection is "index".
Modified Paths:
--------------
releases/1.0/contentSystem.class.php
Modified: releases/1.0/contentSystem.class.php
===================================================================
--- releases/1.0/contentSystem.class.php 2009-05-22 17:28:18 UTC (rev 379)
+++ releases/1.0/contentSystem.class.php 2009-05-27 04:54:31 UTC (rev 380)
@@ -339,6 +339,17 @@
* Retrieves the list of templates & includes in preparation for later work.
*/
private function prepare() {
+
+ //Set the final section...
+ if(count($this->sectionArr)) {
+ $mySectionArr = $this->sectionArr;
+ $this->finalSection = array_pop($mySectionArr);
+ }
+ else {
+ throw new exception(__METHOD__ .": FATAL - section array is empty");
+ }
+
+
//attempt to load any includes...
if($this->fileSystemObj->cd('/includes')) {
$this->load_includes();
@@ -448,12 +459,10 @@
if(isset($lsData[$sectionFile]) && is_array($lsData[$sectionFile])) {
$valid = TRUE;
- $this->finalSection = $this->baseDir;
}
elseif(isset($sectionLsData[$myFile]) && $sectionLsData[$myFile]['type'] == 'file') {
//we're good.
$valid = TRUE;
- $this->finalSection = $this->baseDir;
}
else {
$this->reason = __METHOD__ .": couldn't find base template.";
@@ -653,6 +662,9 @@
//okay, now loop through $this->sectionArr & see if we can include anything else.
$addIndex=false;
+ if($this->finalSection == 'index') {
+ $addIndex = true;
+ }
if(($this->fileSystemObj->cd($this->baseDir)) && is_array($this->sectionArr) && count($this->sectionArr) > 0) {
@@ -672,6 +684,9 @@
if(!$this->fileSystemObj->cd($mySection)) {
//no dice. Break the loop.
$addIndex = false;
+ if($this->finalSection == 'index') {
+ $addIndex = true;
+ }
break;
}
else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|