0

Is there a particular syntax to write commands into a droplet to obtain a "view" of the database into a website? I only know that are written between double [[ ]].

Someone knows anything about the use of droplets in a CMS?

Programmer_3
  • 522
  • 5
  • 18

1 Answers1

0

The droplet call in double brackets is just the name of the droplet with optional parameters. The droplet itself contains usual PHP/SQL code.

For example, if you look at the droplet "users in group" (this is a droplet which shows all users in a given user group), you call it in a WYSIWYG or Code2/HTML section with [[users_in_group?gid=2]]. The droplet itself is created at Admintools > Droplets and contains this code:

global $database;
$rv = '<table border="0" id="users_in_group">';
$rv.= '<thead><tr><th>Benutzername</th><th>E-Mail</th><th>Registriert am</th></tr></thead><tbody>';
$sql = "SELECT * FROM `" . TABLE_PREFIX . "users` WHERE `groups_id` LIKE '%".$gid."%' AND `active`='1' ORDER BY `display_name` ASC";
$results = $database->query($sql);
while($row = $results -> fetchRow()) {
    $rv.='<tr><td>'.htmlentities($row['display_name']).'</td>';
    $rv.='<td><a href="mailto:'.htmlentities($row['email']).'">'.htmlentities($row['email']).'</a></td>';
    $rv.='<td>'.date('d.m.Y',$row['signup_timestamp']).'</td></tr>';
}   
$rv.='</tbody></table>';
return $rv;
David Buck
  • 3,752
  • 35
  • 31
  • 35