WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Current Page Drople combined with if statement issue
  • Print
Pages: [1]   Go Down

Author Topic: Current Page Drople combined with if statement issue  (Read 5945 times)

denkel

  • Guest
Current Page Drople combined with if statement issue
« on: September 17, 2011, 02: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: [Select]
            <?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

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: Current Page Drople combined with if statement issue
« Reply #1 on: September 17, 2011, 03: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

  • Guest
Re: Current Page Drople combined with if statement issue
« Reply #2 on: September 17, 2011, 03: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: [Select]
$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: [Select]
return PAGE_TITLE;

regards,

Dennis
Logged

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: Current Page Drople combined with if statement issue
« Reply #3 on: September 17, 2011, 03: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: [Select]
$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: [Select]
$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.....

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Current Page Drople combined with if statement issue
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2