XML Structure:
XML_Parser.php:
REQUIRE ADDITIONNAL FILES ATTACHED AT BOTTOM OF THIS POST
The output is this: (XML_Parser.php)
http://www.cookingpages.com/cp/sample.php
Now, how would I modify all this so that each tag is seperated?
I want to transfer all those recipes into a MySql databse, but I need to break that down.
The last bit of XML_Parser.php:
echo $content;
I want to do this:
//DB Connect
Insert into DB ( recipename, servings, ingredients, method)
Any ideas how would I go to break this down?
Would I have to edit the function php files and add the database insert stuff there? I think so, however I'll need to make a bunch of IF's for each tag.
if recipename then insert into recipename
if ingredients insert into ingredients blablabla
not really effective no? Help
Thanks :wink2:
HTML:
[...]
<recipe>
<recipename>Zucchini Dinner Rolls</recipename>
<serves>24</serves>
<keywords>Breads</keywords>
<ingredients>
<ingredient>
<quantity>1</quantity>
<unit>pkt</unit>
<name>quick-rise yeast</name>
</ingredient>
<ingredient>
<quantity>1</quantity>
<unit>cup</unit>
<name>warm water (120-130 degrees)</name>
</ingredient>
<ingredient>
<quantity>1/4</quantity>
<unit>cup</unit>
<name>butter or margarine softened</name>
</ingredient>
</ingredients>
<method>
Place zucchini in a bowl; sprinkle with 1/2 teaspoon bla bla bla
</method>
[...]
XML_Parser.php:
PHP:
<?php
require("XMLConverter.class.php");
ob_start();
include("sample.xml");
$content=ob_get_contents();
ob_end_clean();
//Transform XML
$converter=new XMLConverter("taglib.tpl");
$content=$converter->parse($content);
$converter->destroyParser();
echo $content;
?>
REQUIRE ADDITIONNAL FILES ATTACHED AT BOTTOM OF THIS POST
The output is this: (XML_Parser.php)
http://www.cookingpages.com/cp/sample.php
Now, how would I modify all this so that each tag is seperated?
I want to transfer all those recipes into a MySql databse, but I need to break that down.
The last bit of XML_Parser.php:
echo $content;
I want to do this:
//DB Connect
Insert into DB ( recipename, servings, ingredients, method)
Any ideas how would I go to break this down?
Would I have to edit the function php files and add the database insert stuff there? I think so, however I'll need to make a bunch of IF's for each tag.
if recipename then insert into recipename
if ingredients insert into ingredients blablabla
not really effective no? Help
Thanks :wink2:
Attachments
Last edited: