Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 08:26:31 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155552 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Current Page Drople combined with if statement issue  (Read 478 times)
denkel

Offline Offline

Posts: 2


« on: September 17, 2011, 01:34:39 PM »

Hello,

I'm quite new to Website Baker CMS. I made my own template and i'm trying to set a different song for specific pages. I imported an MP3 module which works.
I also made a droplet to recognise which page is open, it looks like this:
return PAGE_TITLE;
You can call it with [[pagetitle]]

Now i'm making an if statement in the footer of my website so i can set a different song at specific pages.
My if statement looks like this:
Code:
            <?php
$pagetitle "[[pagetitle]]";
$page "Drumles";
$welkom "Welkom";
if($pagetitle == $page) {
        
echo "[[Dewplayer?song=1.mp3&autostart=0]]";
}
else {
echo"[[Dewplayer?song=2.mp3&autostart=0]]";
}
?>

The problem is that he doesn't play the 1.mp3 if the page is set at "Drumles", it goes straight to the else.
I tested the [[pagetitle]] droplet which works at any page..

Someone can tell me what i'm doing wrong?

I'm sorry for my english skills ^^

Kind regards,

Dennis
Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #1 on: September 17, 2011, 02:06:39 PM »

Yups, I can.

First, please do post questions once! Either NL or UK.
Start with one language and when a answer is not given, then try the other languages.

The page is made BEFORE the droplets are executed, so the if statement get the [[...]] and not the output of the droplet.

Get everything in a droplet and it will be fine.

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
denkel

Offline Offline

Posts: 2


« Reply #2 on: September 17, 2011, 02:25:48 PM »

Hi,

Okay.

But when I put in it an echo it gives the page name and not the droplet name.
I'm a beginner at making droplets, how am I going to import this in a droplet?

This is my MP3 droplet:
 
Code:
$returnvalue .= '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="160" height="20" id="Hörbeispiel" align="middle">';
$returnvalue .= '<param name="wmode" value="transparent" />';
$returnvalue .= '<param name="allowScriptAccess" value="sameDomain" />';
$returnvalue .= '<param name="movie" value="'.WB_URL.'/dewplayer-mini.swf?mp3='.WB_URL.'/media/'.$song.'&autostart='.$autostart.'" />';
$returnvalue .= '<param name="quality" value="high" />';
$returnvalue .= '<param name="bgcolor" value="FFFFFF" />';
$returnvalue .= '<embed src="'.WB_URL.'/dewplayer-mini.swf?mp3='.WB_URL.'/media/'.$song.'&autostart='.$autostart.'" quality="high" bgcolor="FFFFFF" width="170" height="20" name="Hörbeispiel" wmode="transparent" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';
return $returnvalue;

This is my pagetitle droplet:
Code:
return PAGE_TITLE;


regards,

Dennis
Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #3 on: September 17, 2011, 02:39:20 PM »

Quote
But when I put in it an echo it gives the page name and not the droplet name.
True, surely it will give the pagename

The order of how things work in WB are essential to get this
first the whole output is generated, then the droplets are executed
Code:
$pagetitle = "[[pagetitle]]";
$page = "Drumles";
$welkom = "Welkom";
if($pagetitle == $page) {
Here during output building the $pagetitle stays at [[pagetitle]] so the if will say not equal
Then during droplet execution the [[pagetitle]] will be changed, but the if will not be done again!

Or you need to combine things in one droplet or in this case:
Code:
$pagetitle = PAGE_TITLE;
$page = "Drumles";
$welkom = "Welkom";
if($pagetitle == $page) {
        echo "[[Dewplayer?song=1.mp3&autostart=0]]";
}
else {
echo"[[Dewplayer?song=2.mp3&autostart=0]]";
}

Will work as well
There is in this case no need for the droplet pagetitle

Have fun,
John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!