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 -> PHP

 Question of the year :-)

Print topic Send  topic

Author Message
feha


Posts: 712
Posted: 06/12/2006, 2:52 PM

I have an interesting question ...

is possible to get what components are or exist on the page and what would be the best event mode to "catch" that info ?

example

if page contains a form named

submit_form

search form

etc ...

are these names stored in variables in events mode ?
if so how to get them ?

I tried:
global $MainPage;
print_r($MainPage);
and got lots of information in
$Page_AfterInitialize event

any idea ? :-)
or I'm a dreamer ?

thank you

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 06/12/2006, 7:13 PM

feha
I have you tried asking support to see if they have a suggestion?? Just a thought...
View profile  Send private message
peterr


Posts: 5971
Posted: 06/13/2006, 4:12 AM

Currently this works in various page events:
global $MainPage;  
$vars =  get_object_vars($MainPage);  
foreach ($MainPage as $prop => $val) {  
  if (is_object($MainPage->$prop)) {  
    echo "$prop component<br>";  
  }  
}

Though there is no guarantee that the same code will work in future CCS versions.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
feha


Posts: 712
Posted: 06/13/2006, 4:21 AM

Hello peterr

Thank you very much

You are best :-)
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 06/13/2006, 4:26 AM

I get very nice result :-)

Meta_Tags_inc component
Include_inc component
Header_inc component
User_Info_inc component
Sections_inc component
Navigation_Top_inc component
Adm_Navigation_inc component
Action_Report_inc component
Error_Report_inc component
Page_Info_inc component
cms_controlSearch component
cms_control component
cms_control1 component
ResetForm component
DeleteForm component
Navigation_Right_inc component
Navigation_Bottom_inc component
Footer_inc component
Copyright_inc component
Powered_inc component
Rendertime_inc component


Great ...
How can i get from this which object is Form etc ???

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 06/13/2006, 4:52 AM

I tried to access
$ComponentType

var $ComponentType = "Record";

but can't get it from globals as it is "inside" class ...
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
peterr


Posts: 5971
Posted: 06/13/2006, 5:17 AM

Try:
global $MainPage;    
$vars =  get_object_vars($MainPage);    
foreach ($MainPage as $prop => $val) {    
  if (is_object($MainPage->$prop)) {    
    echo $MainPage->$prop->ComponentType . " - $prop<br>";    
  }    
}
(I'm just a messenger)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
feha


Posts: 712
Posted: 06/13/2006, 11:15 AM

Hello Peter

Thank You Very Much

PERFECT :-)
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 06/13/2006, 12:32 PM

i got this fine result:
IncludablePage - Meta_Tags_inc
IncludablePage - Include_inc
IncludablePage - Header_inc
IncludablePage - User_Info_inc
IncludablePage - Sections_inc
IncludablePage - Navigation_Top_inc
IncludablePage - Languages_inc
IncludablePage - Adm_Navigation_inc
IncludablePage - Action_Report_inc
IncludablePage - Error_Report_inc
IncludablePage - Page_Info_inc
Record - cms_action_responderSearch
Panel - PanelCopyResponses
Record - CopyResponses
Grid - cms_action_responder
Record - cms_action_responder1
IncludablePage - Navigation_Right_inc
IncludablePage - Navigation_Bottom_inc
IncludablePage - Footer_inc
IncludablePage - Copyright_inc
IncludablePage - Powered_inc
IncludablePage - Rendertime_inc

:-)

Still can't find way to get information about components in includable files .


_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
peterr


Posts: 5971
Posted: 06/13/2006, 1:13 PM

You may just want to contact support and discuss this further.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
feha


Posts: 712
Posted: 06/13/2006, 1:18 PM

ok Peter

I want to thank you very much for all your help,
on these very important questions , ate least for me :-)

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
DonB
Posted: 06/13/2006, 7:00 PM

By examining the Tpl object you can learn a bit about the current include:

function dosomething($tpl) {
$path = split("/",$tpl->block_path);
$name = $path[2]; # The desired value seems to always be the [2]
element of the $path array

eval ("global \$$name;");

# now do something with the global variable

}

The eval() function is then able to bring the include (or grid, record, etc)
into 'scope' within your class module. The '\$$' causes the eval to see
something like 'global myIncludePage' and thus correctly execute the line of
code. I passed $Tpl into a class method in this way and used the above code
to find out where it was called from.

(The element [2] part was correct for my application, but you might find
that needs tweaking in your case)
--
DonB

http://www.gotodon.com/ccbth


"feha" <feha@forum.codecharge> wrote in message
news:5448f1d998a2d2@news.codecharge.com...
> ok Peter
>
> I want to thank you very much for all your help,
> on these very important questions , ate least for me :-)
>
> _________________
> Regards
> feha
> Vision.To Design
> www.vision.to
> wowdev.com
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

feha


Posts: 712
Posted: 06/14/2006, 1:08 AM

Hello Don

Thank You for your tips

(accually i need to find what components are in included files before the system "go" to templates :-) similar to $Mainpage and this can be difficult )
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 06/14/2006, 6:54 AM

Support suggested to go back to Peters solution ...

And I came up with:

which list includes components ...
  
global $MainPage;      
$vars =  get_object_vars($MainPage);      
foreach ($MainPage as $prop => $val) {      
  if (is_object($MainPage->$prop)) {      
    //echo $MainPage->$prop->ComponentType . " - $prop<br>";  
  
if($MainPage->$prop->ComponentType == "IncludablePage")  
{  
global $IncludePage;  
$IncludePage= $MainPage->$prop;  
$vars =  get_object_vars($IncludePage);      
foreach ($IncludePage as $includable => $val) {      
  if (is_object($IncludePage->$includable)) {      
    echo $IncludePage->$includable->ComponentType . " - $includable<br>";  
}  
}  
}  
  
  
  }  
       
}  

works great except one error ...
Page - Parent
Page - Parent
IncludablePage - Style_Switcher_inc
Page - Parent

Notice: Undefined property: ComponentType in c:\inetpub\wwwroot\php4\CMS_UNIVERSE\Control.php on line 157
- DBcms
Panel - PanelDefHeader
Label - CMS_BANNER
Label - CMS_HEADER_CONTENT
Grid - cms_section_headers
Page - Parent

Notice: Undefined property: ComponentType in c:\inetpub\wwwroot\php4\CMS_UNIVERSE\Control.php on line 157
- DBcms
Grid - User_Info
Page - Parent
Label - FRONT_SECTIONS
Page - Parent
Label - NAV_TOP
Page - Parent
Label - NAV_USER
Page - Parent
Label - NAV_LEFT
Page - Parent
Panel - PanelAction
Label - ACTION_REPORT
Page - Parent
Panel - PanelError
Label - ERROR_REPORT
Page - Parent

Notice: Undefined property: ComponentType in c:\inetpub\wwwroot\php4\CMS_UNIVERSE\Control.php on line 157
- DBcms
Grid - cms_page_info
Page - Parent
Record - Login
Page - Parent
Label - NAV_RIGHT
Page - Parent
Label - NAV_BOTTOM
Page - Parent
Label - CMS_FOOTER_CONTENT
Page - Parent
Label - CMS_START_YEAR
Label - current_year
Label - CMS_COMPANY
Page - Parent
Label - POWERED_BY
Label - POWERED_BY_LINK
Page - Parent
Label - render_time


:-)



_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 06/14/2006, 6:57 AM

I have now many ideas on how and why to use this information ...
I think You too ...

:-)
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 06/14/2006, 6:59 AM

and the error is
Notice: Undefined property: ComponentType in c:\inetpub\wwwroot\php4\CMS_UNIVERSE\Control.php on line 157
- DBcms

i think there is missing info for DBcms
(connection component)
_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 10/30/2006, 12:09 PM

After update to 3.1
the code does not work ...
http://www.vision.to/CMS/Home/index.php?pid=274

Don't know why
$MainPage->$prop->ComponentType == "IncludablePage"

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
wkempees


Posts: 1679
Posted: 10/30/2006, 4:54 PM

$prop??
too many dollars?

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message

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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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