Archive

Posts Tagged ‘PHP’

CakePHP: remove tmp folder from svn control

March 1st, 2010

We’d have to use propset command from SVN.

$#: cd /path/to/repository/cake_project
$#: svn delete app/tmp/*
$#: svn propset svn:ignore '*' tmp/

Now, after you commit the changes your tmp/files won’t be commited to the SVN repo.

Linux, PHP , ,

CakePHP: named over url parameters passing

January 5th, 2009

Playing around with CakePHP parameters passing through URL, I’ve noticed that using Paginator helper for listing entities mixes up named and url params in the URL.

For instance, classical paginator URL is:

http://domain.com/controller/action/page:number


which looks like:

Array(
[named] =>Array(
[page] => number
)
)

Any parameter used in the Paginator goes inside of the URL and doesn’t affect the behaviour (in my case, URL param is used for language switching), i.e. http://domain.com/controller/action/?param=foo/page:number
No matter what your $this->params['url']['param'] contains – it won’t reflect on the logic.
Thus, if we use another variable $this->params['named']['foo'], we can always access it in our viewers and utilize it in the $paginator variable, so our URL will look like:
http://domain.com/controller/action/page:number/foo:bar
Useful links:
Additional parameters in $paginator

PHP , ,

CakePHP: lists, beautiful bits

August 18th, 2008

These tiny bits of beauty really make the development enjoyable:


$names = $this->find('list', array(
'conditions'=> null,
'order' => 'Developer.id ASC',
'fields' => array('Developer.id','Developer.'.$name.''),
'recursive' => 0
));

as the result, getting:

Array = (
[1] => 'Pafilia',
[2] => 'Vashiotis'
);

I’ll miss these features if I move from this framework :)

Heap , ,