* You are viewing Posts Tagged ‘CakePHP’

JavaScript Code Block in Cake

Sometimes you need to trigger javascript functions or set variables in a view. With JavaScriptHelper, you do not have to print out the <script> tags. All you’ll need is calling a JavaScriptHelper function called codeBlock() function. The <script> tags will be generated itself and a CDATA too if you want it.

Make sure you have added JavaScriptHelper in your Controller where you’ll need the function.
In controller :
$helpers=array(’JavaScript’);

Method codeBlock($string=null, $options=array());
$string = JavaScript codes to be wrapped in <script> tags
$options = There are two parameters, $safe (boolean) and $allowCache (boolean)
The default … Continue Reading

Four (4) steps to set up AJAX Helper in CakePHP

CakePHP has a built-in AJAX helper which required Prototype JS (JavaScript) and Script.aculo.us libraries. To create AJAX interactions with CakePHP is pretty simple and clean.

Four (4) steps to set up AjaxHelper so we could begin to use it :

Download the required JavaScript libraries
Prototype JS could be downloaded at www.prototypejs.org
Script.aculo.us could be download at www.script.aculo.us
Place these JavaScript libraries in /app/webroot/js/.
Add AjaxHelper in your controllers.
For example :
class PostsController extends AppController
{
var $name=’Posts’;
var $helpers=array(’Html’,'Javascript’,'Ajax’);
}
We have to include the … Continue Reading

First Post and CakePHP

It’s been so long not writing on this blog. I decided to delete the old wordpress and set up a new one.
I think it’s the right time to start a brand new blog and more focusing on CakePHP.

It’s been almost one year that i’ve been cooking CakePHP on my kitchen. It’s very good enough PHP Framework, I think. The most well-known feature is super magic console for baking the CRUD pages. It cuts much time to develop PHP applications. I really like it very much. You have to … Continue Reading