George L
|
Posted: 06/07/2004, 11:55 AM |
|
Hi,
I'm following an example in Help file: Change Control Value on Page Level
function Page_BeforeShow() {
global $CurrentUser;
$CurrentUser->SetValue("Bob");
}
On my page (includable header named "admin_header") i'm trying to change the value of some link controls located in layer (DIV).
When I'm trying to add custom code to the Page's BeforeShow event CCS generates not Page_BeforeShow() function but:
function admin_header_BeforeShow()
{
$admin_header_BeforeShow = true;
//End admin_header_BeforeShow
//Custom Code @6-076B3637
// -------------------------
global $admin_header;
// Write your own code here.
If i add something like:
global $lnkUsers;
// Write your own code here.
$lnkUsers->SetValue("AAA");
I'm getting
Fatal error: Call to a member function on a non-object in C:\webroot\admin_header_events.php on line 15
What did I do wrong?
Why there is no function Page_BeforeShow() on my admin_header page?
Thank you
|
|
|
peterr
Posts: 5971
|
Posted: 06/07/2004, 12:24 PM |
|
Hi,
Includable pages work in such way, meaning that you will see the above code instead of Page Before Show. An includable page is rather a component than a page, so that it can be included on other pages like other components (grid, record, etc.). Therefore You would also need to refer to controls placed within includable page as they were placed within other components/forms, for example $Heafer->lnkUsers->SetValue("AAA");
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
George L
|
Posted: 06/07/2004, 1:06 PM |
|
Thank you Peter,
I have tried this:
function admin_header_BeforeShow()
{
$admin_header_BeforeShow = true;
//End admin_header_BeforeShow
//Custom Code @6-076B3637
// -------------------------
global $admin_header;
// Write your own code here.
$admin_header->lnkUsers->SetValue("AAA");
The same error again:
Fatal error: Call to a member function on a non-object in C:\webroot\admin_header_events.php on line 14
|
|
|
peterr
Posts: 5971
|
Posted: 06/07/2004, 1:12 PM |
|
Instead of "$admin_header" try the name of the include component that was placed on the parent page. Otherwise I'm out of ideas. Possibly someone else would answer, or you could contact our support at http://support.codecharge.com.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
ghtracey
Posts: 23
|
Posted: 06/07/2004, 1:25 PM |
|
That works Peter.... I have my header included as a component named Header. On it I inserted a label, Label1.
on the main page Before_Show() I did..
global $Header;
$Header->Label1->SetValue("Test");
The text shows up in the header.
_________________
Graham Tracey
Council of Yukon First Nations |
|
|
George L
|
Posted: 06/07/2004, 1:35 PM |
|
Finally, I've got it working.
I was placing this code on the includable page and not on the parent page.
This works (thanks to Peter):
function Page_BeforeShow()
{
$Page_BeforeShow = true;
//End Page_BeforeShow
//Custom Code @277-8DF1B392
// -------------------------
global $admin_header1;
// Write your own code here.
if (CCGetGroupID()<2) {
$admin_header1->lnkUsers->Visible=False;
}
Peter, Your help is really appreciated!
|
|
|