- Author: Nick Baker [email protected]
- Version: 2.0
- Website: http://www.webtechnick.com
- License: MIT
CakePHP Popup Plugin is a plugin that allows for easy to manage css/xhtml popup content. Content for the popups can be loaded dynamically or read from an element.
- 1.0 Initial Release
- 1.5 Updated to use Jquery or Prototype engines.
- 2.0 Updated to CakePHP 2.x
- PHP5
- Prototype or JQuery
-
clone into
app/Plugin/Popup
directorygit clone git://github.com/webtechnick/CakePHP-Popup-Plugin.git app/Plugin/Popup
-
Edit app
/View/Layouts/Default.ctp
in the of your layout add<?php echo $this->Html->css("/popup/css/default_theme"); ?>
-
Somewhere in the your layout add
<div id="popups" style="z-index: 1000;"></div>
-
Add
Popup.Popup
helper in your controller helper listpublic $helpers = array('Popup.Popup'); //Prototype engine default public $helpers = array('Popup.Popup' => array('Jquery')); //use Jquery public $helpers = array('Popup.Popup' => array('Prototype')); //use Prototype
Link returns a link to be used to load a popup.
Option keys:
- content
is the string of text that will be loaded into the popup.
- element
is the element file (app/views/elements
) to be loaded into the popup.
If both option keys are set, content
takes priority.
Any other option key will be used by the HtmlHelper. View the HtmlHelper options http://book.cakephp.org/view/836/link for more information.
$this->Popup->link(String $title, Array $options);
//load string content into the popup
$this->Popup->link('click me', array('content' => 'this will appear in the popup'));
//load app/views/elements/my_element.ctp into the popup
$this->Popup->link('click me', array('element' => 'my_element'));
//load app/views/elements/my_element.ctp into the popup with variables
$this->Popup->link('click me', array('element' => 'my_element'), array('first_var' => 'value', 'second_var' => 'value 2'));
I will be adding more theme's soon. Feel free to look at the default_theme
for inspiration.
I've added plenty of hooks to play around with in each popup.