[Cs-content-commits] SF.net SVN: cs-content:[368] trunk/1.0/contentSystem.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-03-02 21:10:33
|
Revision: 368 http://cs-content.svn.sourceforge.net/cs-content/?rev=368&view=rev Author: crazedsanity Date: 2009-03-02 21:10:18 +0000 (Mon, 02 Mar 2009) Log Message: ----------- Fix problem with index.inc not always being included. /contentSystem.class.php: * parse_section(): -- remove leading slashes from the DEFAULT_SECTION value. * prepare(): -- remove reference to uninitialized var $cdResult * load_includes(): -- remove extra code ($addIndex) that determines if the index.inc file is included (breaking into two FS objects fixed the problem that the removed code bandaided): if the file exists, include it. Modified Paths: -------------- trunk/1.0/contentSystem.class.php Modified: trunk/1.0/contentSystem.class.php =================================================================== --- trunk/1.0/contentSystem.class.php 2009-03-02 20:33:06 UTC (rev 367) +++ trunk/1.0/contentSystem.class.php 2009-03-02 21:10:18 UTC (rev 368) @@ -287,7 +287,7 @@ //TODO::: this should be an OPTIONAL THING as to how to handle "/" (i.e. CSCONTENT_HANDLE_ROOTURL='content/index') if(($this->section === 0 || is_null($this->section) || !strlen($this->section)) && defined('DEFAULT_SECTION')) { - $this->section = constant('DEFAULT_SECTION'); + $this->section = preg_replace('/^\//', '', constant('DEFAULT_SECTION')); } $myArr = split('/', $this->section); @@ -366,7 +366,7 @@ $foundIncludes = count($this->includesList); $validatePageRes = $this->validate_page(); - if($foundIncludes || ($cdResult && $validatePageRes)) { + if($foundIncludes || $validatePageRes) { //okay, get template directories & start loading $tmplDirs = $this->get_template_dirs(); @@ -670,7 +670,6 @@ $this->load_dir_includes($this->baseDir); //okay, now loop through $this->sectionArr & see if we can include anything else. - $addIndex=false; if(($this->incFs->cd($this->baseDir)) && is_array($this->sectionArr) && count($this->sectionArr) > 0) { @@ -689,13 +688,8 @@ //attempt to cd() into the next directory, or die if we can't. if(!$this->incFs->cd($mySection)) { //no dice. Break the loop. - $addIndex = false; break; } - else { - //okay, we made it to the final directory; add the magic "index.inc" file if it exists. - $addIndex = true; - } } } @@ -704,7 +698,7 @@ if(isset($lsData['shared.inc']) && is_array($lsData['shared.inc'])) { $this->add_include('shared.inc'); } - if(isset($lsData['index.inc']) && is_array($lsData['index.inc']) && $addIndex==true) { + if(isset($lsData['index.inc']) && is_array($lsData['index.inc'])) { $this->add_include('index.inc'); } }//end load_includes() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |