Recommend this page to a friend! |
Download .zip |
Info | Example | Demos | View files (11) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2015-06-14 (1 year ago) | Not enough user ratings | Total: 150 | All time: 8,170 This week: 1,113 |
Version | License | PHP version | Categories | |||
mh_widget 0.2 | MIT/X Consortium ... | 5.3 | HTML, PHP 5, Content management, Temp... |
Description | Author | |||||||||||||
This package can Generate HTML for embedded widgets from parameters. |
|
Demo: http://test.matteohertel.uk/mh_widget/
Flexible, highly configurable widget system replace an HTML place holder with any content.
The main purpose for this package was to be used alongside a text editor like CKEditor to implement a flexible widget system for the end user(http://docs.ckeditor.com/#!/guide/widget_sdk_tutorial_1)
This package will provide a nice and neat interface to create widgets ready to use in any project, there are a lots of feature straight out of the box, but with its flexible nature can fit any need.
There are two main ways to use this package: - Use the widget system standalone as easy way to render HTML - Use the widget system with the integrated parser
To use the widget standalone:
__invkoke
) passing two arguments (one optional): namespace, config array__invkoke
) and return the resultcontroller
method is calledcontroller
method call the model
method to get datacontrolle
r will call and return the view method passing the data from the model
- if the prevent_view
kay is found in the config array the controller will return the data from the model without call the viewWith the integrated parser you can use a custom non-standard html tag mhwidget with attributes to render content from the widget, and example of a working tag:
<mhwidget size="128" email="youremail@gravatr.com">Gravatar</mhwidget>
To be a proper widget the class must extend the WidgetAbstract class and override the __invoke
, controller
, model
and view
methods,
Simple hello world
$widget = new \MHDev\WidgetCore\MH_Widget("\MHDev\Widgets\\");
echo $widget("Example\HelloWorld");
Gravatar
$widget = new \MHDev\WidgetCore\MH_Widget("\MHDev\Widgets\\");
echo $widget("Gravatar", ["email" => "info@matteohertel.com", "size" => 80]);
To see the package in action run the following(php must be available in the console):
git clone https://github.com/matteo-hertel/MH_Widget.git
cd MH_Widget
php -S localhost:8080 -t ./Example
the open your browser to http://localhost:8080
0.2
Please, send me your feedback, using the issue tracker on github or via email to info[at]matteohertel.com
There are no external dependencies but the Parser require the native DOMDocument class and a the widget tag syntax must be right to work properly
MIT
Files |
File | Role | Description | ||
---|---|---|---|---|
Example (2 files) | ||||
MHDev (2 directories) | ||||
.gitignore | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Data | Auxiliary data | ||
README.MD | Doc. | Auxiliary data |
Files | / | Example |
File | Role | Description |
---|---|---|
index.php | Example | Example script |
TestWidget.php | Example | Example script |
Files | / | MHDev | / | WidgetCore |
File | Role | Description |
---|---|---|
MH_Widget.php | Class | Class source |
WidgetAbstract.php | Class | Class source |
WidgetParser.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.