[ Index ] |
|
Code source de SugarCRM 5.0.0beta1 |
1 <? 2 3 /* 4 example 1 5 demonstrates basic template functions 6 -simple replaces ( {VARIABLE1}, and {DATA.ID} {DATA.NAME} {DATA.AGE} ) 7 -dynamic blocks 8 9 10 */ 11 12 require "xtpl.p"; 13 14 $xtpl=new XTemplate ("ex1.xtpl"); 15 16 17 $xtpl->assign("VARIABLE","TEST"); /* simple replace */ 18 19 $xtpl->parse("main.block1"); /* parse block1 */ 20 $xtpl->parse("main.block2"); /* uncomment to parse block2 */ 21 22 /* you can reference to array keys in the template file the following way: 23 {DATA.ID} or {DATA.NAME} 24 say we have an array from a mysql query with the following fields: ID, NAME, AGE 25 */ 26 $row=array( 27 ID=>"38", 28 NAME=>"cranx", 29 AGE=>"20" 30 ); 31 32 $xtpl->assign("DATA",$row); 33 34 $xtpl->parse("main.block3"); /* parse block3 */ 35 36 $xtpl->parse("main"); 37 $xtpl->out("main"); 38 39 /* 40 41 Revision 1.1 2004/05/27 05:30:47 sugarjacob 42 Moving project to SourceForge. 43 44 Revision 1.1 2004/05/19 01:48:20 sugarcrm 45 Adding files with binary option as appropriate. 46 47 Revision 1.2 2001/03/26 23:25:02 cranx 48 added keyword expansion to be more clear 49 50 */ 51 52 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Sep 11 10:48:47 2007 | par Balluche grâce à PHPXref 0.7 |