Skip to content

Instantly share code, notes, and snippets.

@phalcon
Created January 10, 2013 18:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phalcon/4504306 to your computer and use it in GitHub Desktop.
Save phalcon/4504306 to your computer and use it in GitHub Desktop.
<?php echo $this->widgets->create('dialog')->render(array(
"name" => "dialog",
"title" => "Basic dialog",
"content" => "This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon."
)) ?>
<?php
//http://jqueryui.com/dialog/
namespace MyApp\Widgets;
class Dialog
{
public function render($options)
{
echo "<div id="{$options['name']}" title="{$options['title']}"><p>{$options['content']}.</p></div>";
echo '<script>$(function() {$( "#'.{$options['name']}.'" ).dialog();});</script>';
}
}
<?php
$di->set('widgets', function($name){
$widgetClass = 'MyApp\Widgets\\' . $name;
$widget = new $widgetClass();
return $widget;
});
@doit76
Copy link

doit76 commented Jan 14, 2013

Hi,
Is it useable for now? Can I try it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment