Revision: 510
http://cs-content.svn.sourceforge.net/cs-content/?rev=510&view=rev
Author: crazedsanity
Date: 2011-11-27 22:51:13 +0000 (Sun, 27 Nov 2011)
Log Message:
-----------
Return fully-parsed template section.
/cs_genericPage.class.php:
* return_parsed_template (NEW)
-- returns fully-parsed template section (e.g. "menu" or "infobar").
Modified Paths:
--------------
trunk/current/cs_genericPage.class.php
Modified: trunk/current/cs_genericPage.class.php
===================================================================
--- trunk/current/cs_genericPage.class.php 2011-11-25 05:32:47 UTC (rev 509)
+++ trunk/current/cs_genericPage.class.php 2011-11-27 22:51:13 UTC (rev 510)
@@ -296,11 +296,36 @@
}//end of print_page()
//---------------------------------------------------------------------------------------------
-
-
-
+
+
+
//---------------------------------------------------------------------------------------------
/**
+ * Returns a fully-parsed template.
+ */
+ public function return_parsed_template($tmplVar, $stripUndefVars=1) {
+ if(isset($this->templateVars[$tmplVar])) {
+ $oldMd5 = md5(serialize($this->templateVars));
+ $oldTemplateVars = $this->templateVars;
+ $this->add_template_var('main', $this->templateVars[$tmplVar]);
+ $retval = $this->return_printed_page($stripUndefVars);
+ $this->templateVars = $oldTemplateVars;
+ $newMd5 = md5(serialize($this->templateVars));
+ if($oldMd5 !== $newMd5) {
+ throw new exception(__METHOD__ .": old template vars don't match new...");
+ }
+ }
+ else {
+ throw new exception(__METHOD__ .": invalid template var (". $tmplVar .")");
+ }
+ return($retval);
+ }//end return_parsed_template()
+ //---------------------------------------------------------------------------------------------
+
+
+
+ //---------------------------------------------------------------------------------------------
+ /**
* Handles a message that was set into the session.
*/
public function process_set_message() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|