|
 Mihkel Putrinsh - 2006-04-17 10:16:21
I'd like to iterate through number of products like:
<TABLE>
<TR><!-- list of products -->
<TD>{MyProduct.name}</TD>
<TD>{MyProduct.picture}</TD>
<TD>{MyProduct.price}</TD>
</TR>
</TABLE>
 Valics Lehel - 2006-04-18 13:54:59 - In reply to message 1 from Mihkel Putrinsh
by using dinamic blocks
just insert
<!-- BEGIN DYNAMIC BLOCK: row -->
<!-- END DYNAMIC BLOCK: row -->
in the template
<TABLE>
<!-- BEGIN DYNAMIC BLOCK: row -->
<TR><!-- list of products -->
<TD>{NAME}</TD>
<TD>{PICTURE}</TD>
<TD>{PRICE}</TD>
</TR>
<!-- END DYNAMIC BLOCK: row -->
</TABLE>
and in the php script
$page = new FastTemplate( TEMPLATE_PATH );
$page->define( array( "main" => "thetemplate.html" ) );
$page->define_dynamic( "row" , "main" );
//some loop here................
$page->assign( "NAME", MyProduct_name );
$page->assign( "PICTURE", MyProduct_picture);
$page->assign( "PRICE", MyProduct_price);
// where MyProduct_name, MyProduct_picture,MyProduct_price are some variables in php
$page->parse("ROW",".row");
//end loop...........
$page->parse( "MainContent", array( "main" ) );
$page->FastPrint();
 a wilcox - 2006-04-20 08:17:27 - In reply to message 2 from Valics Lehel
is it posible to have two blocks on the same page if so how.
 Valics Lehel - 2006-04-20 13:34:31 - In reply to message 3 from a wilcox
It is the same ;)
<TABLE>
<!-- BEGIN DYNAMIC BLOCK: row -->
<TR><!-- list of products -->
<TD>{NAME}</TD>
<TD>{PICTURE}</TD>
<TD>{PRICE}</TD>
</TR>
<!-- END DYNAMIC BLOCK: row -->
</TABLE>
<TABLE>
<!-- BEGIN DYNAMIC BLOCK: row1 -->
<TR><!-- list of products -->
<TD>{NAME}</TD>
<TD>{PICTURE}</TD>
<TD>{PRICE}</TD>
</TR>
<!-- END DYNAMIC BLOCK: row1 -->
</TABLE>
and in the php script
$page = new FastTemplate( TEMPLATE_PATH );
$page->define( array( "main" => "thetemplate.html" ) );
$page->define_dynamic( "row" , "main" );
//some loop here................
$page->assign( "NAME", MyProduct_name );
$page->assign( "PICTURE", MyProduct_picture);
$page->assign( "PRICE", MyProduct_price);
// where MyProduct_name, MyProduct_picture,MyProduct_price are some variables in php
$page->parse("ROW",".row");
//end loop...........
$page->define_dynamic( "row1" , "main" );
//some loop here................
$page->assign( "NAME", MyProduct_name );
$page->assign( "PICTURE", MyProduct_picture);
$page->assign( "PRICE", MyProduct_price);
// where MyProduct_name, MyProduct_picture,MyProduct_price are some variables in php
$page->parse("ROW1",".row1");
//end loop...........
$page->parse( "MainContent", array( "main" ) );
$page->FastPrint();
|