first serious UDT

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Roberto
Forum Members
Forum Members
Posts: 24
Joined: Thu Oct 25, 2007 6:37 pm

first serious UDT

Post by Roberto »

I use in a template some {cms_module module='DewPlayer' id='?'} with different id, one for each ;) and all work

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');
}
but nothing happend!! I take the code from action.default.php inside DewPlayer module. Some help please!! anything wrong? Somebody would do that in another way? using and external php script maybe?
cyberman

Re: first serious UDT

Post by cyberman »

Try to change first line to

global $gCms;

Maybe you need ful path for songplayer.tpl too.
Roberto
Forum Members
Forum Members
Posts: 24
Joined: Thu Oct 25, 2007 6:37 pm

Re: first serious UDT

Post by Roberto »

Hi Cyberman, thanks for the response.

I remove the first line and take this error:

Code: Select all

Fatal error: Call to a member function Execute() on a non-object in C:\AppServ\www\doghouse\lib\content.functions.php(669) : eval()'d code on line 6
Do you think that this is the best way to take a loop songs using DewPlayer module?

Normally, for example, with news we use:

Code: Select all

{cms_module module='news' number='1' category='en_Estudio' sortby='news_date' summarytemplate='bloquePequeno' moretext='+'}
...and changing number='1' we can take more news. In my case, I need to write one {cms_module module=DewPlayer id=id} for each songs. Maybe there are another way to automate this process for all the songs, do you know ones?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: first serious UDT

Post by Dr.CSS »

Have you seen a new module called play it's from dam the same that gave us the great Album module?...
Post Reply

Return to “Modules/Add-Ons”