| 
<?php
// demo 2 - selective caching
 
 $smartyx->smxUseRelativePath(false);
 
 $smartyx->smxSetTemplate("","demo_bloc.html");
 $smartyx->smxAssign("color","#FFFF99");
 $smartyx->smxAssign("title","bloc 1");
 
 $smartyx->smxSetTemplate("bloc1","demo_bloc.html");
 $smartyx->smxAssign("bloc1.color","#99FFFF");
 $smartyx->smxAssign("bloc1.title","bloc 1.1");
 
 $smartyx->smxSetTemplate("bloc1.bloc1","demo_bloc.html");
 $smartyx->smxAssign("bloc1.bloc1.color","#99FF99");
 $smartyx->smxAssign("bloc1.bloc1.title","bloc 1.1.1");
 
 $bloc_cached = $smartyx->smxSetTemplate("bloc1.bloc2","demo_bloc.html",10,"bloc1.bloc2");
 if (!$bloc_cached)
 {
 // information outwards smartyx
 echo "bloc 1.1.2 not cached<br />";
 
 // emulate "huge" calculation
 for($i=0;$i<1000000;$i++)
 {
 $hello = "hello";
 }
 
 $smartyx->smxAssign("bloc1.bloc2.color","#9999FF");
 $smartyx->smxAssign("bloc1.bloc2.title","bloc 1.1.2 (cache test)");
 }
 else
 {
 // information outwards smartyx
 echo "bloc 1.1.2 cached<br />";
 }
 
 $smartyx->smxSetTemplate("bloc1.bloc4","demo_bloc.html");
 $smartyx->smxAssign("bloc1.bloc4.color","#FF9999");
 $smartyx->smxAssign("bloc1.bloc4.title","bloc 1.1.3");
 
 $smartyx->smxSetTemplate("bloc2","demo_bloc.html");
 $smartyx->smxAssign("bloc2.color","#FF99FF");
 $smartyx->smxAssign("bloc2.title","bloc 1.2");
 
 $smartyx->smxSetTemplate("bloc2.bloc1","demo_bloc.html");
 $smartyx->smxAssign("bloc2.bloc1.color","#FF9999");
 $smartyx->smxAssign("bloc2.bloc1.title","bloc 1.2.1");
 
 $smartyx->smxSetTemplate("bloc2.bloc1.bloc1","demo_text.html");
 $smartyx->smxSetTemplate("bloc1.bloc2.bloc3","demo_text.html");
 $smartyx->smxSetTemplate("bloc1.bloc3","demo_text.html");
 $smartyx->smxSetTemplate("bloc1.bloc5","demo_text.html");
 
 
 $smartyx->smxDisplay();
 
 /*echo "<pre>";
 print_r($smartyx);
 echo "</pre>";*/
 ?>
 |