Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_official / html / includes [ view in CVS ]

Date Directory [filter] File(s) [view] Author [filter]
07 Aug 2002 03:31:33postnuke_official/html/includespnTemplate.php,1.43,1.44Paul Rosania
 first draft pnBlockTemplate(), untested but should work - will code into pnBlockShow and test in a bit

Update of /home/cvsroot/postnuke_official/html/includes
In directory ns7.hostnuke.net:/tmp/cvs-serv24439

Modified Files:
	pnTemplate.php 
Log Message:
first draft pnBlockTemplate(), untested but should work - will code into pnBlockShow and test in a bit


Index: pnTemplate.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/includes/pnTemplate.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** pnTemplate.php	5 Aug 2002 17:53:07 -0000	1.43
--- pnTemplate.php	7 Aug 2002 03:31:31 -0000	1.44
***************
*** 664,667 ****
--- 664,738 ----
      return $output;
  }
+ 
+ /**
+  * turns block output into a template
+  *
+  * @access public
+  * @param moddir the directory the module is in
+  * @param type user|admin
+  * @param func module function to template
+  * @param args arguments for the template
+  * @param template the specific template to call
+  * @return output output of the template
+  **/
+ function pnBlockTemplate($module, $block, $args = array(), $template = NULL)
+ {
+     // FIXME <marco> You should note that $moddir != $moddir, you're doing a wrong thing!
+     //               If you don't use module (that is module name), accept moddir as param.
+     // FIXME <marco> Could you make regenerate an optional param instead of a global?
+     $theme = pnUserGetTheme();
+ 
+     if (isset($template)) {
+         $template = pnVarPrepForOS($template);
+     }
+     
+     // Try theme template
+     $template_sourcefile = "$theme/modules/$moddir/blocks/$block" . (isset($template) ? "-$template.pnt" : '.pnt');
+     $template_file = 'cache/templates/' . md5($template_sourcefile) . '.php';
+    
+     if (!file_exists($template_file) && !file_exists($template_sourcefile)) {
+         // FIXME: <marco> This is wrong because no one want to load the default template as fallback here.
+         //if (isset($template)) {
+             // Try with default template
+             //return pnModTemplate($moddir, $type, $func, $args);
+         //}
+         // Use internal template
+         $template_sourcefile = "modules/$moddir/pntemplates/pnblocks/$block" . (isset($template) ? "-$template.pnd" : '.pnd');
+         $template_file = 'cache/templates/' . md5($template_sourcefile) . '.php';
+ 
+             if (!file_exists($template_sourcefile)) {
+                 $msg = pnML('Could not locate template source for function \'#(1)\' in module \'#(2)\', missing file path is: \'#(3)\'.', $func, $moddir, $template_sourcefile);
+                 pnExceptionSet(PN_SYSTEM_EXCEPTION, 'UNKNOWN',
+                                new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
+                 return;
+             }
+     }
+ 
+     if (pnVarCleanFromInput('regenerate') == true || !file_exists($template_file) ||
+         filemtime($template_sourcefile) > filemtime($template_file)) {
+         $res = pnTplCompile($template_sourcefile);
+         if (!isset($res)) {
+             return; // Throw back
+         }
+     }
+     
+     // $args should be an array (-even-if- it only has one value in it), 
+     // if it's not throw an exception.
+     if (is_array($args)) {
+         extract($args, EXTR_OVERWRITE);
+     } else {  
+         $msg = pnML('Incorrect format for args -- Must be an array of arguments');
+         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'UNKNOWN',
+             new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
+                 return;
+     }
+         
+     ob_start();
+     include $template_file;
+     $output = ob_get_contents();
+     ob_end_clean();
+     return $output;
+ }
+ 
  ////
  //FIXME johnny better description


Directory filter : [ all ] / postnuke_official / html / includes [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3