MY_Xml_Writer - Easy XML writer library |
[eluser]JoostV[/eluser]
That's not too hard. Just fetch some data and loop through it. Code: /*Fetch students from database*/ As to your second question: just supply the URL that produces this XML to Flash, via Flashvar. Say the XML is produced by www.example.com/xml/students. Then you would put a Flashvar in your page, like so. Code: <script type='text/javascript' src='jscripts/swfobject.js'></script> Pick up the FlashVar in Flash and load the XML.
[eluser]Shimura[/eluser]
Thank you JoostV, for you helping. But i have i little problem : The script return me an error (not with my AMP in local, that's right but online, i have this : Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /.../system/application/libraries/MY_Xml_writer.php on line 40.
[eluser]JoostV[/eluser]
@Shimura: Did you check you have PHP 4.3.0 or higher? The parent class XML was not introduced until then. http://nl2.php.net/xmlwriter EDIT: Also, XML writer needs to be enabled in your php.ini. This comes as default in many PHP installation, but you never know.
[eluser]Shimura[/eluser]
Hello JoostV, I need to count the number of node in a foreach : For example, i have : <Projet_Graph>1</Projet_Graph> <Projet_Graph>1</Projet_Graph> <Projet_Graph>1</Projet_Graph> And i need this : <Projet_Graph>3</Projet_Graph> PHP : foreach ($value as $value2) { $xml->addNode('Projet_Graph',count($total)); } Thank you.
[eluser]JoostV[/eluser]
Add a counter and display its value. Code: $iCounter = 0; Hope it helps you out.
[eluser]Shimura[/eluser]
It's already display one node for one result. I haven't a total result for one node. I have a foreach with a value $corr = array ( Graphist, AD, Art Director,...); and in my foreach i make a if with preg_match : Code : $icounter = 0; foreach ($correspondance_graph as $corr){ /* Test Projets Graphique */ if(preg_match('`'.$corr.'`', '`'.$row->fonction.'`' )){ $xml->addNode('Projet_Graph',count($icounter)); $icounter++; } } $row->fonction this the result of my query. The result is always : <Projet_Graph>1</Projet_Graph> <Projet_Graph>1</Projet_Graph> <Projet_Graph>1</Projet_Graph>
[eluser]Shimura[/eluser]
And it's the same with $xml->addNode(‘Projet_Graph’,$icounter); I think that my foreach make always a node when i have a result of my test preg_match with a word.
[eluser]JoostV[/eluser]
Dear Shimura, Could you be more specific? I have no idea what you are trying to accomplish.
[eluser]Shimura[/eluser]
I have a table MySQL with function in a Web Project : for example : Art Director, Developer,... And in my XML i try to recover the name of the job like a value (+1) when the prag_match find the same word in my table of correspondence ($correspondance_graph = array(AD, Graphist,...) with my query ($row->fonction, query(SELECT fonction FROM ...) i recover a value in my XML like that : 1</Projet_Graph> -> one match word and for two match word : 2</Projet_Graph> and not this result : 1</Projet_Graph> 1</Projet_Graph> This the problem.
[eluser]Shimura[/eluser]
I think that the problem is with the foreach or the condition when he finds a word with a correspondence, he makes a node and not a total of value. |
Welcome Guest, Not a member yet? Register Sign In |