NickM
Posts: 44
|
| Posted: 10/05/2004, 10:33 PM |
|
Hi all,
When I try this simple example (see below) to add custom HTML, I get a blank Live page.
If I add text directly to the page, it shows in Live Page; but the Label control remains stubornly empty.
Here is the example I am trying:
Add Custom HTML to a Page
This example shows how to display custom HTML dynamically using a Label control.
Add a Label control called CustomHTML.
Set the Content property of the Label to HTML.
In the Before Show event of the Label, add the code below:
PHP
function Page_BeforeShow() {
global $CustomHTML;
$CustomHTML->SetValue("MyData <table><tr><td>Data 1</td><td>Data 2</td></tr></table>" );
}
|
 |
 |
peterr
Posts: 5971
|
| Posted: 10/06/2004, 2:07 AM |
|
The function would need to be called after being defined. We provide this example as a function, but directly in the event you don't need to declare such function and only execute:
global $CustomHTML;
$CustomHTML->SetValue("MyData <table><tr><td>Data 1</td><td>Data 2</td></tr></table>" );
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
NickM
Posts: 44
|
| Posted: 10/06/2004, 3:18 AM |
|
Thanks Peter,
I don't mean to perster, but how and where in the code/HTML do you do that?
|
 |
 |
peterr
Posts: 5971
|
| Posted: 10/06/2004, 3:25 AM |
|
Same place that you described in your 1st post. Just remove the function definition from your code.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
NickM
Posts: 44
|
| Posted: 10/06/2004, 6:46 AM |
|
Thanks Peter.
Works like a dream.
Now for the hard bit.
I was thinking about using this method to add DHTML that creates a drop-menu.
However, I get a Parse error "unexpected T_STRING in ..."
Is there a better /preferred way to do this or do I need to change a few settings somewhere to make it work?
|
 |
 |
peterr
Posts: 5971
|
| Posted: 10/06/2004, 7:59 AM |
|
Nick,
The above method is standard PHP code and is not related to CodeCharge Studio settings. You would just need to create a string with your DHTML and use it in the SetValue method. Try creating a regular PHP string first, then do: $CustomHTML->SetValue($YourString).
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
NickM
Posts: 44
|
| Posted: 10/06/2004, 11:51 PM |
|
Peter,
PERFECT, Thanks!
There is just one more thing to do:
Make the page "includable" so I can add this to all other pages.
Unfortunately when I do this (say YES to Includable), something breaks.
I get warnings like this:
Warning: main(RelativePath/index_events.php) [function.main]: failed to open stream: No such file or directory in ....on line 93
Warning: main() [function.include]: Failed opening ... for inclusion... on line 93
Any idea what I need to do to fix this.
All I've done is change the file to "includable" . I'm soooo close to getting it right. It's the foundation for the remainder of the site, so I have to get over this hurdle.
Thanks. Nick
|
 |
 |
NickM
Posts: 44
|
| Posted: 10/07/2004, 12:21 AM |
|
Bit of trial and error...
When I include the page in a new page I get this error:
Fatal error: call to member function SetValue() on a non-object in c:\....\index_events.php on line 634
Does this help?
|
 |
 |
peterr
Posts: 5971
|
| Posted: 10/07/2004, 4:06 AM |
|
Such errors could probably have many different meanings so it's hard to analyze them without debugging, but I suspect that you just need to change "$CustomHTML->SetValue($YourString)" to "$IncludablePageName->CustomHTML->SetValue($YourString)"
Actually the $IncludablePageName may need to be the name of the control that was used on the main page to include the includable page.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |