Eric
|
Posted: 04/15/2004, 5:35 PM |
|
I want to generate a template variable or block in the header area of the HTML template in CCS. For example:
function MyFunction(slink){
<!-- BEGIN TargetCCM -->
var myvar = {myvarfield} ;
<!-- END TargetCCM -->
more js code ...
}
or simply:
function MyFunction(slink){
var myvar = {myvarfield} ;
more js code ...
}
The problem is that the {myvarfield} does not get generated by the code:
$Tpl->Setvar("myvarfield",$value) ;
$Tpl->Parse("TargetCCM ",False); (if in a block)
CCS return an error when using a BEGIN/END block :
"Undefined index: /Record SCMNk/TargetCCM in ....template.php on line 188".
When not using a begin-end block, no error code is generated and no data is generated.
I think that the error is because the path to the block is wrong and CCS can't find it.
I have not been able to find a way to switch the path. has any
one had this problem and found a solution?
Thanks
Eric
|
|
|
thomas2340
Posts: 55
|
Posted: 04/18/2004, 10:47 PM |
|
hi,
add this code into the before show event of your page, so that ccs can find your block
$Tpl->Setvar("myvarfield",$value) ;
$Tpl->Parse("TargetCCM ",True);
put this into your javascript section in the html template, dont forget to set the $value or for testing change it to "test"
<!-- BEGIN TargetCCM -->
{myvarfield}
<!-- END TargetCCM -->
good luck, thomas
|
|
|
|