[Cs-content-commits] SF.net SVN: cs-content:[446] trunk/1.0/cs_genericPage.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
|
From: <cra...@us...> - 2009-08-18 20:43:20
|
Revision: 446
http://cs-content.svn.sourceforge.net/cs-content/?rev=446&view=rev
Author: crazedsanity
Date: 2009-08-18 20:43:12 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
Removed code duplication for stripped undefined template vars.
/cs_genericPage.class.php:
* print_page():
-- call strip_undef_template_vars() instead of doing EXACTLY what it
does already (the code for the called method was copied directly from
print_page() at one point, I'm guessing this part was simply
forgotten).
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-08-18 20:36:41 UTC (rev 445)
+++ trunk/1.0/cs_genericPage.class.php 2009-08-18 20:43:12 UTC (rev 446)
@@ -280,28 +280,10 @@
$this->templateObj->parse("out","main"); //parse the sub-files into the main page
if($stripUndefVars) {
- $numLoops = 0;
- while(preg_match_all('/\{.\S+?\}/', $this->templateObj->varvals['out'], $tags) && $numLoops < 50) {
- $tags = $tags[0];
-
- //TODO: figure out why this works when running it twice.
- foreach($tags as $key=>$str) {
- $str2 = str_replace("{", "", $str);
- $str2 = str_replace("}", "", $str2);
- if(!isset($this->templateVars[$str2]) && $stripUndefVars) {
- //TODO: set an internal pointer or something to use here, so they can see what was missed.
- $this->templateObj->varvals['out'] = str_replace($str, '', $this->templateObj->varvals['out']);
- if(isset($this->unhandledVars[$str2])) {
- $this->unhandledVars[$str2]++;
- }
- else {
- $this->unhandledVars[$str2] = 1;
- }
- }
- }
- $this->templateObj->parse("out", "out");
- $numLoops++;
- }
+ $this->templateObj->varvals['out'] = $this->strip_undef_template_vars(
+ $this->templateObj->varvals['out'],
+ $this->unhandledVars
+ );
}
$this->templateObj->pparse("out","out"); //parse the main page
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|