Here is a Modal / Lighbox / Popup module for Kohana 3

August 9, 2012

We needed modal functionality for a Kohana 3 app we have. I could see how this could be reusable in our future applications and for everyone else developing on Kohana 3, so I put it in a module to share with you. This module is used to created a lightbox style modal window.



-Kohana 3.0+. This will not work on Kohana V2.
-JQuery needs to be loaded before Modal is displayed.


This Modal module is very easy to use. Put the modal folder in the modules directory of your Kohana application. Include it

in your bootstrap.php file:

'modal'        => MODPATH.'modal',        // Modal/Lightbox style Windows

Put the following code right under the tag:

 echo Modal::display(); 

Change the config file in the module directory to better suit your model window size and traits.

Congrats, the module is installed! Set a modal by:

Modal::Set($message(message or a loaded view), $locked( optional boolean defaulted to false));

If $locked is set to true, the screen will be locked, not allowing the user to exit the modal.

You may also add the class “modal-close” to any element. If that element is clicked it will exit the modal unless locked.

If any questions or requests, be sure to comment.

Stay in Touch!

Subscribe to our newsletter.

Solutions Architecture

browse through our blog articles

Blog Archive