Html_Template_Flexy and JavaScript
| From: | Didier Galland | Date: | Thu, 08 Jan 2004 03:38:11 +0000 |
| Subject: | Html_Template_Flexy and JavaScript | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10045@lists.php.net to get a copy of this message | ||
Hi,
I'm trying to use some flexy vars in Javascript functions and the
replacement doesn't occurs. I suppose It's caused by the comments "<!--
... -->" inside the <script> tag.
Of course if I remove comments flexy complains about this ugly practice ;-)
Is there an easy way to make flexy replacements in js functions ??
I've seen in 6.0 change log :
<flexy:toJavascript flexy:prefix="js_name_prefix_" jsvar="php_flexy_var"
....>
uses HTML_Javascript_Convert to import PHP variables into Javascript.
Is this my problem's solution ? How can I use it in functions ?
Thanks for any help.
Regards,
Didier
PS. : an extract of my template :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>remote scripting marker_id = {marker.marker_id}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript1.2">
<!--
function updateParentFrom(id){//this is called from an iframe to do some
remote scripting
window.parent.updateField('qte_ml_'+ id,'{marker.qte_ml}');//field, value
window.parent.updateField('qte_m2_'+ id,'{marker.qte_m2}');
window.parent.updateField('prix_net_ml_'+ id,'{marker.prix_net_ml}');
window.parent.updateField('prix_unitaire_1_'+
id,'{marker.prix_unitaire_1}');
window.parent.updateField('total_ht_'+ id,'{marker.total_ht}');
window.parent.updateField('pu_net_'+ id,'{marker.pu_net}');
window.parent.updateField('total_net_'+ id,'{marker.total_net}');
}
//-->
</script>
</head>
<body onLoad="updateParentFrom({marker.marker_id});">
{marker:r} output a perfect result
</body>
</html>