Jeroen
|
| Posted: 07/26/2002, 7:09 AM |
|
How can I inlcude a page I made with a grid and events with custom code?
Because when I try to do it I lose all events with custom code.
I'm using CCS with PHP and MySQL.
|
|
|
 |
Jeroen
|
| Posted: 07/28/2002, 9:47 AM |
|
I really need to know how to do this, because I have a grid with custom events which I have to include in every page. Else I have to rebuild this grid for every page I make and that costs too much time.
|
|
|
 |
Nicole
|
| Posted: 07/29/2002, 6:56 AM |
|
Jeroen,
as far as you work with includable page the syntax of the code should be slightly different.
Looking into the code of the page the another is included into, you'll see that new instance of the cls<includable_page_name> class is created.
If you look into the code for includable page you'll see that is corresponds the one class, that is different from standard page. That's why all the components of the includable page (connection, forms, etc.) could be accessed through
$page_name->component_name
So the code in the events of includable page should be like:
E.g.
global $page_name;
$TotalVoices=CCDLookUp( "field_name", "table_items", "f1=". $page_name->field_name->ds->Parameters["urlfield_name"] , $page_name->DBconnection_name);
$page_name->field_name->SetValue($results);
|
|
|
 |
Nicole
|
| Posted: 07/29/2002, 6:56 AM |
|
Jeroen,
as far as you work with includable page the syntax of the code should be slightly different.
Looking into the code of the page the another is included into, you'll see that new instance of the cls<includable_page_name> class is created.
If you look into the code for includable page you'll see that is corresponds the one class, that is different from standard page. That's why all the components of the includable page (connection, forms, etc.) could be accessed through
$page_name->component_name
So the code in the events of includable page should be like:
E.g.
global $page_name;
$TotalVoices=CCDLookUp( "field_name", "table_items", "f1=". $page_name->field_name->ds->Parameters["urlfield_name"] , $page_name->DBconnection_name);
$page_name->field_name->SetValue($results);
|
|
|
 |
Nicole
|
| Posted: 07/29/2002, 6:56 AM |
|
Jeroen,
as far as you work with includable page the syntax of the code should be slightly different.
Looking into the code of the page the another is included into, you'll see that new instance of the cls<includable_page_name> class is created.
If you look into the code for includable page you'll see that is corresponds the one class, that is different from standard page. That's why all the components of the includable page (connection, forms, etc.) could be accessed through
$page_name->component_name
So the code in the events of includable page should be like:
E.g.
global $page_name;
$TotalVoices=CCDLookUp( "field_name", "table_items", "f1=". $page_name->field_name->ds->Parameters["urlfield_name"] , $page_name->DBconnection_name);
$page_name->field_name->SetValue($results);
|
|
|
 |
Jeroen
|
| Posted: 07/29/2002, 1:27 PM |
|
Thank you for the tip Nicole. But CodeCharge Studio somehow doesn't allow me to add custom code. Normally at the top of the events file it starts with binding the events. This is gone when making the file includable. But all the BeforeShow and AfterInitialize functions are still there. And they all look like this:
function shoppingcart_shopping_partsl1_BeforeShow() { //shoppingcart_shopping_partsl1_BeforeShow @42-510CDAC2
//Custom Code @128-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
//End Custom Code
} //Close shoppingcart_shopping_partsl1_BeforeShow @42-FCB6E20C
All my code is set to //DEL at the end of the page. When I try to add custom code in the functions, it simply deletes it again. So I can never add any custom code to the events. Is this a bug or does it have a reason?
|
|
|
 |
Jeroen
|
| Posted: 07/29/2002, 2:07 PM |
|
I think it's a bug. It all works now! What I did is the following.
First I deleted all the events and added them again. This time it somehow worked. So for the CodeCharge crew: when seeting a page with custom events to includable you can't add any events, whenever you try to add it, it's deleted when you switch windows. You'll first have to delete all custom code and then add it again.
Nicole, first I added only $page_name->field_name->SetValue($results);
not thinking I had to add the gridname too.
$page_name->Grid_name->field_name->SetValue($results);
But I figured it out :)
Thanks again Nicole.
|
|
|
 |
CodeCharge Support
|
| Posted: 07/31/2002, 4:14 AM |
|
Jeroen,
please submit the request to the support system at http://support.codecharge.com/support_new.asp
and provide the sequence of steps you followed
|
|
|
 |
|