By: Jesus
Date: 2006-12-08
Time: 18:03
|
Method of an Object with a present Block
Hello, I am trying to show a block with a method of an object that receives like parameter a data of the block in which it is then moment
Here this code PHP
$sql_formacion1 = "
SELECT F.ANO_INI_FORM || '-' || F.ANO_TER_FORM ANO_TER_FORM,
F.DSC_NIVEL_FORM,
F.COD_INST
FROM FOMENTOLA.EN_FORMACAO F WHERE F.COD_RH = '0000326437' ";
$rs_formacion1 = $conn->Execute("$sql_formacion1");
$arr_formacion1 = $rs_formacion1->GetRows();
class MyClass {
var $new;
var $mont = 4900000;
function getAndSetNew($n){
$this->new= $n."000";
return $this->new;
}
}
$obj_class = new MyClass();
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('formacion_tit.html');
$TBS->MergeBlock('formacion',$arr_formacion1);
$TBS->Show();
|
Here this code HTML
<table width="600" height="63" border="0" align="center" cellpadding="0" cellspacing="1">
<tbody>
<tr bgcolor="#829DC2" class="titulo_menu">
<td width="15%" height="19"><div align="center">PerĂodo</div></td>
<td width="23%"><div align="center">666</div></td>
<td width="23%"><div align="center">Nivel</div></td>
</tr>
<tr class="nombre_campo_1">
<td height="18"><div align="center"> [formacion.ANO_TER_FORM;block=tr;.]</div></td>
<td align="center">[var.obj_class.getAndSetNew(formacion.ANO_TER_FORM);block=tr;.]</td>
<td align="center"> [formacion.DSC_NIVEL_FORM;block=tr;.]</td>
</tr>
<tr class="nombre_campo_2">
<td height="18"><div align="center"> [formacion.ANO_TER_FORM;block=tr;.]</div></td>
<td align="center">[var.obj_class.getAndSetNew(formacion.ANO_TER_FORM);block=tr;.]</td>
<td align="center"> [formacion.DSC_NIVEL_FORM;block=tr;.]</td>
</tr>
</tbody>
</table>
|
|
By: RwD
Date: 2006-12-09
Time: 19:26
|
Re: Method of an Object with a present Block
If you want a template variable to merge you shouldn't put it in as plain text. That means you should try this: [var.obj_class.getAndSetNew([formacion.ANO_TER_FORM]);block=tr;.] |
But that isn't entirely correct either. You put in block=tr inside of a field which does not merge as a block. So remove the "block=tr;" as well.
Please consult the manual and examples for correct usage of fields!
|
By: Jesus
Date: 2006-12-13
Time: 00:42
|
Re: Method of an Object with a present Block
Thanks will take it into account, I want to execute single a Function, and what I did she was to create a class and a method so that this made the work, since the manual explains that single it is possible to be executed methods of a class and on the attributes and not only functions single Example Code PHP.
$sql_formacion1 = "
SELECT F.SALARIO, F.DSC_NIVEL_FORM,
FROM FOMENTOLA.EN_FORMACAO F WHERE F.COD_RH = '$s_cod_rh' ";
$rs_formacion1 = $conn->Execute("$sql_formacion1");
$arr_formacion1 = $rs_formacion1->GetRows();
function test($mont){
$mont = $mont + 150000;
return $mont;
}
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('formacion_tit_OLD.html');
$TBS->MergeBlock('formacion',$arr_formacion1);
$TBS->Show();
|
Example Code HTML.
<table width="600" height="63" border="0" align="center" cellpadding="0" cellspacing="1">
<tbody>
<tr bgcolor="#829DC2" class="titulo_menu">
<td width="15%" height="19"><div align="center">PerĂodo</div></td>
<td width="23%"><div align="center">666</div></td>
<td width="23%"><div align="center">Nivel</div></td>
</tr>
<tr class="nombre_campo_1">
<td>[formacion.ANO_TER_FORM;block=tr;.]</td>
<td>[test(formacion.MONTO)]</td>
<td>[formacion.DSC_NIVEL_FORM;block=tr;.]</td>
</tr>
</tbody>
</table>
|
Or single to execute a simple function.
Thanks friends.
|
|
Posting in progress.
Please wait...
|