Hello All,
Finally after researching for hours we got the solution to call a model inside a helper class. we hope this helps you.
In a method of your helper class just use : $this->ModelName=& ClassRegistry::init(’ModelName’);
And now $this->ModelName has all the property of the model.
Do let us know if you are unable to use the same.
Happy Algo-blogging.
Hello friends getting lightbox/modalbox in to the application is really an addon to the site.
Here are few simple steps to get lightbox/modalbox working on your cakephp site.
- Download ModalBox (you also need a prototype + script.aculo.us files there.) extract them all and place the files in webroot folder. (files you should see after extraction are “js/cakemodalbox.js” , “js/modalbox.js”, “css/modalbox.css”, “css/spinner.gif”).
- Include 4 javascripts i.e prototype.js, scriptaculos.js, modalbox.js and cakemodalbox.js in your default template file in the same order mentioned here. (Note for cakemodalbox.js coming below modalbox.js)
- In your controller include 2 lines of code
- var $components = array(’RequestHandler’); // note for ‘RequestHandler’
- var $helpers = array(’Html’,'Javascript’, ’Ajax’);
- There are no changes in model specifically.
- Now for example you want to show a view file say your login page with lightbox then just follow the simple steps.
- Include var $components = array(’RequestHandler’); and var $helpers = array(’Html’,'Javascript’, ’Ajax’); in your controller. In my case it is user controller.
- Now for example you want to show a view file say your login page with lightbox then just follow the simple steps.echo $html->link(’Login’,array(’action’ => ‘ControllerName/login‘),array(’title’ => ‘Customer details’,'onclick’ => “Modalbox.show(this.href, {title: this.title, width: 400}); return false;”));
change the ‘ControllerName’ as per your need.
Likeways you can show any page in a light box or modalbox.
Do let us know in case of any issue.
Algoworks