xml question - pulling data from a database |
[eluser]got 2 doodle[/eluser]
Hi all , I'm just looking for a little direction here. I am working on my second CI app and as much as I am understanding how to work with CI and am still not 100% on how CI 'works' I want to use a mp3 media player that loads a play list from an .xml file. I have proven that I can simply substitute a .php file to output xml with this code. playlist.php Quote:<?phpthis was down and dirty but it would be easy to pull data from a database and format it accordingly. code to load playlist into media player Code: [removed] So this works but this was straight (X)HTML and PHP. In CI I have worked with the models/ controllers and views to build views but how would I access a database using CI, I cannot just put the XML into a variable, it seems that the player requires me to point to a file. This doesn't work Code: so.addVariable("playlist", "$playlist"); I'm just having a little trouble conceptualizing how I am going to do this. The application will have a list of mp3 files associated with a certain band, each band will have an id - pretty typical stuff I think. It's no problem to get a list of mp3's from a model but this is returned to my controller and then to my view. How do I get this information when the player wants to point to a file? Do I just step aside from all of CI's power and make playlist.php access the database? Do I use a controller? I am planning to use the url segment to track the id of the band http://localhost/nsbands.com/index.php/bands/artist/4 example for band id=4 Hmm....thinking...... doodle Thanks in advance
[eluser]got 2 doodle[/eluser]
Update to previous post, what I meant was This doesn't work Code: so.addVariable("playlist", "<?php echo $xmlhead.$xml;?>"); Maybe I am making things more difficult than it needs to be, probably just as well to put a separate playlist file in each bands directory. Hmm....thinking... doodle
[eluser]Chris Newton[/eluser]
I use CI + Flash frequently. Rather than calling playlist.php, I just call something like playlist_controller/playlist_method So yeah, a controller calls the database, based on the parameter passed in (in my case, I use controllers+models+views)
[eluser]got 2 doodle[/eluser]
Excellent and thanks, I'll see what I come up with. doodle |
Welcome Guest, Not a member yet? Register Sign In |