CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Multi-level Template - PHP SOLUTION

Print topic Send  topic

Author Message
thiamat

Posts: 14
Posted: 08/20/2006, 7:53 AM

Here is the html template  
--------------------------------------------------------------------------  
<table cellspacing="0" cellpadding="0" width="100%" border="0">  
  <tr>  
    <td valign="top">  
      <table class="Header" cellspacing="0" cellpadding="0" border="0">  
        <tr>  
          <td class="HeaderLeft"><img src="../../Styles/GSM/Images/Spacer.gif" border="0"></td>   
          <th>Forum</th>  
   
          <td class="HeaderRight"><img src="../../Styles/GSM/Images/Spacer.gif" border="0"></td>   
        </tr>  
   
      </table>  
   
      </td>   
  </tr>  
   
  <tr>  
    <td valign="top">  
      <!-- BEGIN forum_group -->  
      <table class="Header" cellspacing="0" cellpadding="0" border="0">  
        <tr>  
          <td>{forum_group_name}</td>   
        </tr>  
   
      </table>  
   
      <table class="Grid" cellspacing="0" cellpadding="0" width="100%">  
        <tr class="Caption">  
          <th width="60%">{res:GSM_forum}</th>  
   
          <th width="10%">{res:GSM_forum_subject}</th>  
   
          <th width="10%">{res:GSM_forum_messages}</th>  
   
          <th width="20%">{res:GSM_forum_lastmsg}</th>  
   
        </tr>  
   
  
        <!-- BEGIN forum_item -->  
        <tr class="Row">  
          <td>{forum_name}</td>   
          <td>{forum_subjects}</td>   
          <td>{forum_messages}</td>   
          <td>{forum_last_message}<br>  
            by {forum_last_user}</td>   
        </tr>  
 <!-- END forum_item -->  
      </table>  
   
      <hr><!-- END forum_group --></td>   
  </tr>  
   
  <tr>  
    <td valign="top"> </td>   
  </tr>  
</table>  

_________________
No Code No Pain !
Just think
View profile  Send private message
thiamat

Posts: 14
Posted: 08/20/2006, 7:54 AM

  
Here is the BeforeShow event code  
----------------------------------------------------------------  
//Custom Code @2-2A29BDB7  
// -------------------------  
global $Tpl;  
  	//	list forum groups  
    $db		=	new	clsDBgsm();  
	$SQL	=	"SELECT * FROM app_gsmkb_forum_group ORDER BY group_index";  
	$db->query( $SQL);  
  
	//	parse result  
	while( $db->next_record())	{  
		//	retrieve datas  
		$group_id		=	$db->f( "group_id");  
		$group_name		=	$db->f( "group_name_default");  
  
		//	list group forum's  
		$l_db	=	new	clsDBgsm();  
		$l_SQL	=	"SELECT * FROM app_gsmkb_forum_list WHERE group_id=$group_id ORDER BY list_index";  
		$l_db->query( $l_SQL);  
  
		//	---> go up on the templte tree  
		$bp		=	$Tpl->block_path;  
		$Tpl->block_path	=	$Tpl->block_path . "/forum_group";  
  
		//	parse result  
		//	!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
		//	!!!	Reset block value ( clear accumulation)  
		$Tpl->SetBlockVar( "forum_item", "");	  
		while( $l_db->next_record())	{  
  
	  		//	retrieve datas  
	  		$forum_id			=	$l_db->f( "forum_id");  
	  		$forum_name			=	$l_db->f( "list_name_default");  
	  		$forum_subjects		=	$l_db->f( "count_subject");  
	  		$forum_messages		=	$l_db->f( "count_msg");  
	  		$forum_last_time	=	$l_db->f( "last_time");  
	  		$forum_last_user	=	$l_db->f( "last_user");  
	    
	  		//	build template  
	  		$Tpl->SetVar("forum_name", $forum_name);  
	  		$Tpl->SetVar("forum_subjects", $forum_subjects);  
	  		$Tpl->SetVar("forum_messages", $forum_messages);  
	  		$Tpl->SetVar("forum_last_time", $forum_last_time);  
	  		$Tpl->SetVar("forum_last_user",$forum_last_user);  
	  		$Tpl->Parse("forum_item", true);  
	  	}  
  
		//	retrieve template generated block  
		//	!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
		//	!!!	Read block value ( current accumulation)  
		$forum_list_block	=	$Tpl->GetVar("forum_item");		  
//		$forum_list_block	=	"<tr class='Row'><td>{forum_name}</td><td>{forum_subjects}</td><td>{forum_messages}</td><td>{forum_last_message}<br>by {forum_last_user}</td></tr>";  
  
		//	<--- go down on the templte tree  
		$Tpl->block_path	=	$bp;  
  
		//	build template  
		//	!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  
		//	!!!	Set block value ( at the right tree level)  
		$Tpl->SetBlockVar( "forum_item", $forum_list_block);  
		$Tpl->SetVar("forum_group_name", $group_name);  
		$Tpl->Parse("forum_group", true);  
	}  
  
  
// -------------------------  
//End Custom Code  

_________________
No Code No Pain !
Just think
View profile  Send private message
thiamat

Posts: 14
Posted: 08/20/2006, 7:57 AM

Not my fault the the forum does not manage tabs :-D

Rock and roll baby

By the way if you guys could create a repeating dreamwaever stil panel this would be awsome

and GG for this APP
_________________
No Code No Pain !
Just think
View profile  Send private message
peterr


Posts: 5971
Posted: 08/20/2006, 1:13 PM

     Here are     s     p     a     c     e      s
	Here are		t	a	b	s

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
peterr


Posts: 5971
Posted: 08/20/2006, 1:14 PM

Thanks thiamat. Please use the Code feature when posting code.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
thiamat

Posts: 14
Posted: 08/20/2006, 1:37 PM

Thanks peterr now you guys can see what I mean:-D
_________________
No Code No Pain !
Just think
View profile  Send private message
paolo
Posted: 10/03/2006, 7:40 AM

I'm tried to apply this example but the grid it create correctly write the header but don'report any row ... it eems to be a problem in the nested block, please can you help me?

HTML CODE:
...

<!-- BEGIN annunci -->
<h1>{tpl_editorial_cat}</h1>

<table cellspacing="1" cellpadding="5" border="0">
<!-- BEGIN Row -->
<tr>
<td valign="top" width="125">{tpl_image_url}</td>
<td valign="top">
<b>{tpl_article_title}</b>
<p>{tpl_article_desc}</p>
</td>
</tr>
<!-- END Row -->
</table>
<!-- END annunci -->
...

PHP SCRIPT:

//--- carica il blocco ANNUNCI
$db = new clsDBInternetDB();
$SQL = "SELECT category_id,category_name ";
$SQL.= "FROM store_editorial_products ";
$SQL.= "INNER JOIN store_editorial_categories ";
$SQL.= "ON store_editorial_products.editorial_cat_id=store_editorial_categories.category_id ";
$SQL.= "ORDER BY category_name";
$db->query($SQL);

while ($db->next_record()):
$category_id=$db->f("category_id");
$category_name=$db->f("category_name");

$l_db = new clsDBInternetDB();
$l_SQL = "SELECT DISTINCT store_editorial_products.editorial_cat_id,article_title, article_desc, image_url,product_name ";
$l_SQL.= "FROM store_products INNER JOIN store_editorial_products ";
$l_SQL.= "ON store_products.product_id = store_editorial_products.product_id ";
$l_SQL.= "INNER JOIN store_editorial_categories ";
$l_SQL.= "WHERE store_editorial_products.editorial_cat_id=$category_id ";
$l_SQL.= "ORDER BY product_name";
$l_db->query($l_SQL);

$bp =$Tpl->block_path;
$Tpl->block_path=$Tpl->block_path ."/annunci";
$Tpl->SetBlockVar( "row", "");

while ($l_db->next_record()):
$Tpl->SetVar("tpl_image_url",$l_db->f("image_url"));
$Tpl->SetVar("tpl_article_title",$l_db->f("article_title"));
$Tpl->SetVar("tpl_article_desc",$l_db->f("article_desc"));
$Tpl->Parse("row", TRUE);
endwhile;

$grid_row_block=$Tpl->GetVar("row");
$Tpl->block_path=$bp;
$Tpl->SetBlockVar( "row", $grid_row_block);
$Tpl->SetVar("tpl_editorial_cat", $category_name);
$Tpl->Parse("annunci", true);

endwhile;
$l_db->close();
$db->close();
paolo
Posted: 10/03/2006, 7:53 AM

I'm sorry but the ONLY problem is this:

HTML TEMPLATE USE Row

PHP SCRIPT SEARCH FOR row

All works fine!!!
Thiamat you are a CCS master! Please, where I can find more informations about variable, block and so on? (on CCS help this is explained not exaustively)

Thank you
again
Paolo

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.