Pages

Showing posts with label shortcut. Show all posts
Showing posts with label shortcut. Show all posts

Tuesday, October 2, 2012

document.getElementByid(id)=>shortcut

Use eval(id)
for example

eval("myelement")

returns an element with id "myelement"

Sunday, June 26, 2011

Transactions Shortcut in Cakephp

Add the following functions in app/models/AppModel

function begin()
{
$db=&ConnectionManger::getDataSource
$db->begin($this);
$this->useDbConfig;
}

function commit()
{
$db->commit($this);
}

function rollback()
{
$db->rollback($this);
}

Now in you controller
Use
$this->Model->Begin()
$this->Model->commit();
$this->Model->rollback();