ShotokanTuning Posted October 13, 2008 Share Posted October 13, 2008 I've a couple directories filled with thousands of xml files. I'm expected to generate, menu's with html links from each directory. I was thinking of using scandir() for that. Also all these xml files should be reachable with their filename in the url. For example in the article directory the xml file named news.xml should be reachable like this: http://www.website.com/article/news.php 2nd example in the articles directory the xml file named helpwithjeans.xml should be reachable like this: http://www.website.com/article/helpwithjeans.php?l=0 3rd example in the products directory the xml file named bluray.xml should be reachable like this: http://www.website.com/product/bluray.php?l=1 How to read what url is typed and process it by going to the right xml file? After that the xml still needs to be converted to one of several specific html formats. Something like using the parameter "l" see in above examples (2nd and 3rd) to know which layout is desired and which xml elements to grab. How can this be handled? And if there is multiple options, what do you suggest is a good way to handle this. Thanks for pointing me in the right direction! I was thinking XSLT might be the way to convert the xml to html but I don't know how to use the "l" parameter from the url (if I'm heading int hat direction) in the XSLT and that would really be needed. I'm really open to any input. Everything may help. Thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/128181-asking-for-suggestions-on-how-to-work-with-xml-files-in-php/ Share on other sites More sharing options...
keeB Posted October 16, 2008 Share Posted October 16, 2008 In the XSLT world, you would expect a variable and apply it in your template. If you do not know a lot about XSLT I do not consider going that route, as it is fairly complex. Sounds like you have quite the task on your hands. Good luck. Quote Link to comment https://forums.phpfreaks.com/topic/128181-asking-for-suggestions-on-how-to-work-with-xml-files-in-php/#findComment-666849 Share on other sites More sharing options...
ShotokanTuning Posted October 16, 2008 Author Share Posted October 16, 2008 Hi keeB, Thanks a lot for the reply. I've worked with XSLT before, just never used php together with xslt. How to expect a variable and apply it in the template? For example, I know of <xsl:param name="parameter"/> but I don't know how to use this with php. How to send that param to the xslt? My biggest question is how to have the user type the url, catch that url with a php file/code and have it build a html page from the hidden xml file in the url. With other words if I have for example the url "http://www.website.com/article/news.php" I want to catch that url (and every other url with the pattern http://www.website.com/article/*.php) with some php code. That php code needs to be able to grab the xml file, in this case in the directory article take the file with the name "news.xml" and convert it to a html page. Thank you kindly, ST Quote Link to comment https://forums.phpfreaks.com/topic/128181-asking-for-suggestions-on-how-to-work-with-xml-files-in-php/#findComment-666875 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.