sadcox666
|
Posted: 07/05/2005, 7:30 PM |
|
A component like the 'include file' compoent that allows me to output results/errors/message - which I guess I will call the ShowMessages component.
Input: comma delimited varaible names e.g., A, B,C
process:
.html
<!-- BEGIN ShowMessages1 -->
<tr>
<td colspan="2" class="KnockoutDataTD">
{A}
</td>
<td>{B}</td>
<td>{C}</td>
</tr>
<!-- END ShowMessages1 -->
.php
I am new to CCS and I have not figured out if it should be
if($this->FormSubmitted) {
$Tpl->SetVar("A", $Error);
$Tpl->SetVar("B", $Error);
$Tpl->SetVar("C", $Error);
$Tpl->Parse("Msg", false);
}
or If I need to have a block at all ? like the php example
$Tpl->SetVar("VariableName",$strKey);
$Tpl->SetVar("VariableValue",$value);
$Tpl->Parse("MyTable",True);
There is a lot of information about Custom Template Blocks
but I am still trying to figure out what parameter to pass to Parse(,)
and what the true/false mean.
I think I am not looking in the right place if someone reads this please
post below.
All I want to do is display results/message after executing some PHP classes
so I know if the functions have succeeded or failed.
For me much more difficult than I anticipated.
|
|
|
peterr
Posts: 5971
|
Posted: 07/06/2005, 12:45 AM |
|
I'm not sure if I understood your question correctly but usually the Label control can be used for displaying anything custom. You can create any part of a Web page in PHP and assign the resulting HTML to a label - it will then be inserted in place of the label. I've even seen calendars, galleries, schedules and other complex components implemented in PHP and their output displayed by assignning it to a label.
Thus assuming that your HTML contains a label named {A} then all you need to do in PHP is: $A->SetValue($Error);
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
sadcox66
Posts: 6
|
Posted: 07/06/2005, 7:00 AM |
|
Peter,
Thank you for the update. What you described is exactly what I want to do in the near future. However I am still having a small problem.
I placed a 'form' submit button(button1) and a label (label1) on a new page.
Events for the label.
And this works :)
//Label1_BeforeShow @3-61C72663
function Label1_BeforeShow()
{
$Label1_BeforeShow = true;
//End Label1_BeforeShow
//Custom Code @4-85BC3D26
// -------------------------
global $Label1;
// Write your own code here.
$Label1->SetValue("Before Show");
// -------------------------
//End Custom Code
Events for the submit button
This does not work
//Button1_OnClick @2-509C0F4F
function Button1_OnClick()
{
$Button1_OnClick = true;
//End Button1_OnClick
//Custom Code @5-AD63FC9B
// -------------------------
global $Button1;
// Write your own code here.
global $Label1;
$Label1->SetValue("Button Clicked !");
// -------------------------
//End Custom Code
//Close Button1_OnClick @2-C0F6CC45
return $Button1_OnClick;
}
Any pointers as to what I am doing wrong ?
|
|
|
datadoit.com
|
Posted: 07/06/2005, 7:34 AM |
|
The button should be within a form control. Otherwise, you'll need to use
Javascript to control the button.
|
|
|
sadcox66
Posts: 6
|
Posted: 07/06/2005, 7:50 AM |
|
Quote datadoit.com:
The button should be within a form control.
Thank you ... This is definitely one of the problems.
I added
<form method="post" action="{Action}" name="{HTMLFormName}">
...
</form>
but no success... yet.
I was under the impression that if I pick the HTML elements from the
Forms tool box the form would get added automatically. The same elements are also in the <>HTML toolbox and I am not sure which one
I should use.
By the way the <form> statement above is from an example. Is there a way to get CCS to automatically add it to the page so the HTML and PHP are synchonized.
Any advise where else I can look... perhaps moderator can move this thread to appropriate forum.
|
|
|
sadcox66
Posts: 6
|
Posted: 07/06/2005, 8:39 AM |
|
Found code charge has a lot of features, builders etc.
So I decided I will use the "Search Builder" and use the form definitions it creates to test the same principles.
I added a label1 to the new form created and On the Label1.BeforeShow
global $Label1;
$Label1->SetValue("Button Clicked !");
I receive the error
Fatal error: Call to a member function on a non-object in
I am certain I need a lot of education, I looked at the tutorials and have confused myself as were to start when building an application. Also need some steps/principles to follow to get started correctly.
Unlike most of the tutorial examples I am not using a database but simply calling a phpClass and executing functions from it.
|
|
|
DonB
|
Posted: 07/07/2005, 6:35 AM |
|
What ths message means is, "$Label" does not refer to an object. In this
case, the object Label1 is contained within a form such that the correct
reference must be something like $myForm->Label1->SetValue().
The "global" will always be that of the topmost object, never to an 'inner'
object such as a Label. The inner objects must be referenced without a "$"
and with the "->" operator.
--
DonB
http://www.gotodon.com/ccbth
"sadcox66" <sadcox66@forum.codecharge> wrote in message
news:2242cbfb4375a0b@news.codecharge.com...
> Found code charge has a lot of features, builders etc.
>
> So I decided I will use the "Search Builder" and use the form definitions
it
> creates to test the same principles.
>
> I added a label1 to the new form created and On the Label1.BeforeShow
>
> global $Label1;
> $Label1->SetValue("Button Clicked !");
>
> I receive the error
> Fatal error: Call to a member function on a non-object in
>
> I am certain I need a lot of education, I looked at the tutorials and have
> confused myself as were to start when building an application. Also need
some
> steps/principles to follow to get started correctly.
>
> Unlike most of the tutorial examples I am not using a database but simply
> calling a phpClass and executing functions from it.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
|