PHP Classes

how to generate lists

Recommend this page to a friend!

      Fast Template  >  All threads  >  how to generate lists  >  (Un) Subscribe thread alerts  
Subject:how to generate lists
Summary:Is there a way to create a list of objects?
Messages:4
Author:Mihkel Putrinsh
Date:2006-04-17 10:16:21
Update:2006-04-20 13:34:31
 

  1. how to generate lists   Reply   Report abuse  
Picture of Mihkel Putrinsh 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>

  2. Re: how to generate lists   Reply   Report abuse  
Picture of Valics Lehel 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();


  3. Re: how to generate lists   Reply   Report abuse  
Picture of a wilcox 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.

  4. Re: how to generate lists   Reply   Report abuse  
Picture of Valics Lehel 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();