CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Include a grid several times

Print topic Send  topic

Author Message
Pulp
Posted: 07/06/2004, 12:55 AM

Hello,

I am using CCS with PHP and mySQL and I would like to include a grid several times in a page, in order to have several different lists.

When I try to do this, CCS creates different blocks, for example : {include_page}, {include_page1}, {include_page2}...
But then, only the first included page is ok, because there is custom code in my included page.

Let's look a this piece of code :

  
// custom code  
global $include_page;  
$include_page->element->SetValue($value);  

This code works if my included block's name is {include_page} but won' work for {include_page1}, or {include_page2}...

How can I solve this problem ?

Thanks !

Pulp

Sixto Luis Santos
Posted: 07/06/2004, 7:07 AM

Hello Pulp,

First, please reconsider using include files for this. If you need to have
the same grid parsed several times to display differrent data sets, there
are better ways to do it. I can help you with that.

Anyway, with some fancy PHP voodoo incantation it is possible to get the
context of the called event. The main thing is to always remember to replace
the variable holding the class instance (in your example, $include_page)
with $$parent_class. This applies not only when getting the class in context
(with global), but also when setting properties or calling methods of the
class.

  
$bktrace=debug_backtrace();  
$parent_class=$bktrace[3]["args"][0]; // Magic indices. Do not change unless  
you understand what it does.  
  
// custom code  
//global $include_page;  
global $$parent_class;  
  
//$include_page->element->SetValue($value);  
$$parent_class->element->SetValue($value);  

I won't try to explain how it works. If you are interested, you can lookup
the debug_backtrace() function in the PHP manual.

Regards,

Sixto


"Pulp" <Pulp@forum.codecharge> wrote in message
news:240ea5afe7d32d@news.codecharge.com...
> Hello,
>
> I am using CCS with PHP and mySQL and I would like to include a grid
several
> times in a page, in order to have several different lists.
>
> When I try to do this, CCS creates different blocks, for example :
> {include_page}, {include_page1}, {include_page2}...
> But then, only the first included page is ok, because there is custom code
in
> my included page.
>
> Let's look a this piece of code :
>
>
  
> // custom code  
> global $include_page;  
> $include_page->element->SetValue($value);  
> 
>
> This code works if my included block's name is {include_page} but won'
work for
> {include_page1}, or {include_page2}...
>
> How can I solve this problem ?
>
> Thanks !
>
> Pulp
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Pulp
Posted: 07/06/2004, 7:21 AM

Well, in fact that's what I tried... but it's not ok, because it means that I would have to modify both page.php and page_events.php files... and, you know, if you modify page.php, CCS wont recognize it then...

But i'm quite interested by your alternative solution... what do you mean with "there are better ways to do" ?

Thanks for your help !

Pulp
Sixto Luis Santos
Posted: 07/06/2004, 9:05 AM

Pulp,

Please, contact me: ccs at tecnoapoyo dot com

Regards,

Sixto


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.