WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: warp on May 26, 2013, 04:43:08 PM

Title: [SOLVED] Style a droplet
Post by: warp on May 26, 2013, 04:43:08 PM
Is there a way to style the [[ModifiedWhen]] droplet?
I'using  
Code: [Select]
<span style="font-size:9px;">[[ModifiedWhen]]</span> to reduce the font size.
Can I somehow integrate it in the original code:
Code: [Select]
global $database, $wb;
if (PAGE_ID>0) {
$query=$database->query("SELECT modified_when FROM ".TABLE_PREFIX."pages where page_id=".PAGE_ID);
$mod_details=$query->fetchRow();
return "Deze pagina is laatst gewijzigd/aangepast op ".date("d-m-Y",$mod_details[0]);
}

I thought something like this would do it, but to no avail:

Code: [Select]
return <span style="font-size:9px;">
"Deze pagina is laatst gewijzigd/aangepast op ".date("d-m-Y"
</span>
,$mod_details[0]);
Title: Re: Style a droplet
Post by: pcwacht on May 26, 2013, 05:49:57 PM
Allmost, you forgot the '

Code: [Select]
return '<span style="font-size:9px;">Deze pagina is laatst gewijzigd/aangepast op '.date("d-m-Y",$mod_details[0]).'</span>';

or make it more readable:
The .= appends text to a variable.
Code: [Select]
$return_string = '<span style="font-size:9px;">Deze pagina is laatst gewijzigd/aangepast op ';
$return_string .= date("d-m-Y",$mod_details[0]);
$return_string .= '</span>';
return $return_string;

Have fun,
John
Title: Re: Style a droplet
Post by: warp on May 26, 2013, 06:16:39 PM
Wow, that is a really quick and accurate answer!
Even better: It Works  :wink:

John, thanks a lot.

Frank Kalf