Welcome Guest, Not a member yet? Register   Sign In
Music Stream Website
#1

[eluser]Unknown[/eluser]
I am developing a website to stream music. I want to create a xspf playlist and then feed this to the xspf player. I am very new to CI and PHP.

I am using the XMLWriter by JoostV for generating the playlist.

In my view when ever user submit the items to play it triggers the playlist controller. Here is my code:

Code:
function playlist()
    {
        $this->load->library('MY_Xml_writer');
        $xml = new MY_Xml_writer;
        $xml->setRootName('playlist');
        $xml->initiate();
        // Start branch 1
        $xml->startBranch('trackList');
        // Start branch 2
        $this->load->model('Album');
        if (isset($_POST['playlist']))
        {
            foreach($_POST['playlist'] as $title) {
                $musicpath = $this->Album->getmusicpath($title);
                foreach($musicpath->result() as $row)
            {
            $xml->startBranch('track'); // start branch
            $xml->addNode('location', 'http://localhost/music/'.$row->path);
            $xml->endBranch();    
            }
            }            
        }        
        
        $xml->endBranch();
        $data['xml'] = $xml->getXml();
        $this->load->view('playlist_view', $data);
        redirect('music/musicplayer');
    }
    function musicplayer(){
        $this->load->view('music-player_view');        
    }
}

But it shows there is no items in the xspf player playlist.
#2

[eluser]macfamous[/eluser]
thanks for sharing this code .. very usefull for me to develop music site too then ..




Theme © iAndrew 2016 - Forum software by © MyBB