Created
January 10, 2013 18:01
-
-
Save phalcon/4504306 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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." | |
)) ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$di->set('widgets', function($name){ | |
$widgetClass = 'MyApp\Widgets\\' . $name; | |
$widget = new $widgetClass(); | |
return $widget; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Is it useable for now? Can I try it?