Re: Html_Template_Flexy and JavaScript
| From: | Didier Galland | Date: | Thu, 08 Jan 2004 04:23:43 +0000 |
| Subject: | Re: Html_Template_Flexy and JavaScript | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10047@lists.php.net to get a copy of this message | ||
I've found by myself how to use <flexy:toJavascript ...>. Great and very
easy ! In a word : flexy !
Even if {var} would have been more simple.
NB: I can't use '_' in my javascript vars, flexy points it as invalid
character (allowed in javascript ???). So I had to change some of my var
names. Is this an intended feature ??
Would it be possible to use some HTML_Javascript_Convert features like
HTML_Javascript_Convert::convertArray by this way ?? which syntax then ?
Thanks Alan for the great "flexy" work ! I'm more impressed every day !!
Oh and <flexy:happy_new_year ...>
Regards,
Didier
PS : If this can help somebody : here is the js part of my updated template
:
<flexy:toJavascript flexy:prefix="flex_"
markerId = "marker.marker_id"
qteMl="marker.qte_ml"
qteM2="marker.qte_m2"
prixNetMl="marker.prix_net_ml"
prixUnitaire1="marker.prix_unitaire_1"
totalHt="marker.total_ht"
puNet="marker.pu_net"
totalNet="marker.total_net">
<script language="JavaScript1.2" type='text/javascript'>
<!--
function updateParentFrom(){
var id=flex_markerId;
window.parent.updateField('qte_ml_'+ id,flex_qteMl);
window.parent.updateField('qte_m2_'+ id,flex_qteM2);
window.parent.updateField('prix_net_ml_'+ id,flex_prixNetMl);
window.parent.updateField('prix_unitaire_1_'+ id,flex_prixUnitaire1);
window.parent.updateField('total_ht_'+ id,flex_totalHt);
window.parent.updateField('pu_net_'+ id,flex_puNet);
window.parent.updateField('total_net_'+ id,flex_totalNet);
}
----- Original Message -----
From: "Didier Galland" <listsdg@appli-box.com>
To: <pear-general@lists.php.net>
Sent: Thursday, January 08, 2004 4:38 AM
Subject: [PEAR] Html_Template_Flexy and JavaScript
> 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>
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>