Jump to content
#StayAtHome ×


This topic is now archived and is closed to further replies.


XML file maintainer

Recommended Posts

First, this is the first PHP project of the sort I've come up with. So, I'm a noob. :-)


Ok, the basics of what this project will be:


My church uses a program to display the slides for the words to the music that uses a XML files to store the songs. Its a great system (program is called OpenSong), and we haven't run into any problems until now. See, we have several computers (four or five) that all have the program installed. We want them all to have all the song files, all the same version. We might catch a mistake in one file, and update it on one computer, but then we have to take the file to all the other computers via USB stick, and change them. The list gets very, very long after a few weeks. Not to mention the new songs we make.


So, I was wondering if I could build a PHP application that would store all the XML files, and I could make a very simple web front end to edit those files. Then, I could tell it to zip up and download all the songs (current versions), and extract those songs into the songs folder on the hard drive.


I know its possible. Just... how do I go about using it? I don't need any user authentication. Just a main page that lets you zip up and download the songs, and also has a dynamic text area with all the names of the songs, where you can select one and edit it. Or, I could have a link to another page, which generates hard links to the files, and from there I can click on them. Either way. I would also need a feature to create more songs from a blank template (with all the basic XML tags filled in already).



My idea:


<main page>

Main page lets you d/l the zip file

and links to list page

and links to create song page

</main page>


<list page>

PHP opens the song folder on the server, and generates hard links to every song file. When you click on the file, it sends you to edit page.

</list page>


<edit page>

Page that shows forms, already filled in with the song information and lyrics. You can edit as needed, and save

</edit page>


<create song page>

similar to edit song, but imports the blank file, and lets you edit, then saves as the title name

</create song page>



One catch is that the song files are XML without the XML extension. When I open them in notepad, I see the XML tags, etc, but they do not have file extensions.



Any suggestions??


Just want to make sure I'm on the right track here!



Share this post

Link to post
Share on other sites

What exactly are you asking after?  The application flow seems to make sense to me.  Also, for the XML I have found an amazing tool that I feel compelled to recommend.  It honestly made my life much easier, here's the link:


It's free, open source, works on PHP 4 and I believe self explanatory.  It doubt the file extensions will be an issue.


As for how to go about hosting it...


Well you'll want some procedure/class to intercept $_GET or $_POST requests and direct them to a page controller.  The page controller should then get a directory listing or file and generate some HTML.


Let me know if you have more questions, or want more specific details.


// shameless plug, I also have some utilities that may be useful for you available (in my sig), but they're for php 5

Share this post

Link to post
Share on other sites

Well, I'm using PHP 5.


I can't seem to find a good, decent tutorial on importing XML files. Some seem outdated, only for PHP 4, and the new ones for PHP 5 are so vague.


I'll keep looking though. I'll be hosting this on my own server.

Share this post

Link to post
Share on other sites

Well the class that I linked initially is a great tool for importing XML.  All you do is extend the class and create functions named handle_ then the tag name.  (this is explained in the class documentation) Then whenever that tag is hit the function is called.  You have access to the attributes etc, just look at the method signature.  At any rate you just instantiate the new class you've created, pass it a file or string of XML, and get the results.

Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.