1 Reply Latest reply on Dec 18, 2007 1:19 AM by sulletf

    [EN] Copy / Paste of PHP in mxml [FR] Copier / Coller pur de PHP dans le mxml

    samuel2202
      English bottom

      Bonjour,

      Je voudrais copier / coller du code dynamique grâce à PHP dans le mxml de Flex... :

      J'ai actuelement ce code :
      quote:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="700" height="350" backgroundColor="#ffffff">
      <!-- Lignes verticales -->
      <mx:VRule x="186" y="20" width="1" height="285" strokeColor="#CCCCCC"/>
      <!-- Lignes de base -->
      <mx:VRule x="151" y="20" width="1" height="285" strokeColor="#999999"/>
      <mx:HRule x="146" y="300" width="480" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="265" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="230" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="195" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="160" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="125" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="90" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="55" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="20" width="5" height="1" strokeColor="#999999"/>
      </mx:Application>

      Je voudrais qu'il soit "dynamique" :
      quote:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="700" height="350" backgroundColor="#ffffff">
      TEXT PHP ICI
      </mx:Application>

      Là où il y a "Text PHP ici", je voudrais que ça soit remplacer - a chaque rechargement de page - par un code généré par php.
      Voila le php :
      quote:

      <?php
      echo '<!-- Lignes verticales -->
      <mx:VRule x="186" y="20" width="1" height="285" strokeColor="#CCCCCC"/>
      <!-- Lignes de base -->
      <mx:VRule x="151" y="20" width="1" height="285" strokeColor="#999999"/>
      <mx:HRule x="146" y="300" width="480" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="265" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="230" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="195" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="160" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="125" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="90" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="55" width="5" height="1" strokeColor="#999999"/>
      <mx:HRule x="146" y="20" width="5" height="1" strokeColor="#999999"/>';

      ?>

      Ce qui ferais donc que j'aurais le même code que celui que j'ai actuelement.

      Le but : C'est pour des graphiques "personalisés" que j'utilise ça. PHP se connecte à MySQL, fait tout les calculs des x, y, etc.. et renvoi donc à flex le code mxml :)

      Merci d'avance à tous.


      ENGLISH :

      Hello,

      I would like to copy/stick dynamic code thanks to PHP in the mxml of Flex…:

      I have this code now:
      quote:

      <? xml version= " 1.0 " encoding= " utf-8 "? >
      <mx: Xmlns application: mx= " http://www.adobe.com/2006/mxml " layout= " absolute " width= " 700 " height= " 350 " backgroundColor= " #ffffff " >
      <! -- Vertical lines -->
      <mx: VRule x= " 186 " y= " 20 " width= " 1 " height= " 285 " strokeColor= " #CCCCCC "/>
      <! -- Base lines -->
      <mx: VRule x= " 151 " y= " 20 " width= " 1 " height= " 285 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 300 " width= " 480 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 265 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 230 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 195 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 160 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 125 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 90 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 55 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 20 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      </mx: Application>



      I would like that it is “dynamic”:
      quote:

      <? xml version= " 1.0 " encoding= " utf-8 "? >
      <mx: Xmlns application: mx= " http://www.adobe.com/2006/mxml " layout= " absolute " width= " 700 " height= " 350 " backgroundColor= " #ffffff " >
      TEXT PHP HERE
      </mx: Application>



      Where there is “Text PHP here”, I would like that that is to replace - each recharging of page has - by a code generated by php.
      Veiled the php:

      quote:

      <? php
      echo '<! -- Vertical lines -->
      <mx: VRule x= " 186 " y= " 20 " width= " 1 " height= " 285 " strokeColor= " #CCCCCC "/>
      <! -- Base lines -->
      <mx: VRule x= " 151 " y= " 20 " width= " 1 " height= " 285 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 300 " width= " 480 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 265 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 230 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 195 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 160 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 125 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 90 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 55 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>
      <mx: HRule x= " 146 " y= " 20 " width= " 5 " height= " 1 " strokeColor= " #999999 "/>';

      ? >


      What would thus make that I would have the same code as that which I actuelement have.

      The goal: It is for “personalized” graphs that I use that. PHP is connected to MySQL, makes all calculations of X, y, etc. and reference thus with flex the code mxml:)

      Thank you in advance with all.
        • 1. Re: [EN] Copy / Paste of PHP in mxml [FR] Copier / Coller pur de PHP dans le mxml
          sulletf Level 1
          English
          It is indeed possible to generate mxml with PHP, as mxml is xml hence pure text file.
          To run mxml, it is first needed to compile it : i don't think it is a good solution to recompile a source each time a page is loaded ...

          The only way to generate objects dynamically in Flex is to use ActionScript.

          French
          C'est possible de générer du mxml via PHP en effet, car mxml est du xml et donc un simple fichier texte.
          Ensuite il faut recompiler le source mxml pour pouvoir l'exécuter : je ne pense pas que ce soit une bonne solution de recompiler un source à chaque rechargement de page ...

          La seule solution pour créer des objects dynamiquement dans Flex, c'est ActionScript.