
Now, I want to create a small script to take all the song that I've in the DB (table cms_db_prefix()+module_dewplayer). For this, I try to create a UDT with this content:
Code: Select all
if (!isset($gCms)) exit;
$db = &$gCms->db;
$query = 'SELECT * FROM '.cms_db_prefix().'module_dewplayer';
$dbresult = $db->Execute($query);
if( !$dbresult ){
echo 'DB error: '. $db->ErrorMsg()."<br/>";
}
while ($dbresult && $row = $dbresult->FetchRow()){
$swfurl = "modules/".$this->GetName()."/media/dewplayer.swf";
$swfurl .= "?son=".$row['songurl'];
if ($row['autostart'] == 1) {
$swfurl .= "&autostart=1";
}
if ($row['autoreplay'] == 1) {
$swfurl .= "&autoreplay=1";
}
if ($row['bgcolor']) {
$swfurl .= "&bgcolor=".$row['bgcolor'];
}
if ($row['level'] && $row['level'] != 100) {
$swfurl .= "&volume=".$row['level'];
}
$this->smarty->assign('tplSwfUrl', $swfurl);
$this->smarty->assign('tplWidth', $row['witdh']);
$this->smarty->assign('tplHeight', $row['height']);
echo $this->ProcessTemplate('songplayer.tpl');
}