Category Archives: Programming

Cakephp3: Installing Cakephp3

23666Cakephp 3 depends a lot on using composer, so youll need to get that first.; http://getcomposer.org/

Once youve set up composer you can create a brand new cakephp3 app by;

  1. Going to your web servers “htdocs” folder. I.e if your using xammp it should be; C:xampphtdocs
  2. Open a command windows here and type;
    composer create-project --prefer-dist cakephp/app my_app_name
  3. Cakephp will create a folder in your htdocs folder called ” my_app_name”
  4. Open http://localhost/my_app_name

Cakephp 3 installation:
http://book.cakephp.org/3.0/en/installation.html

Cakephp Tips – Sort Data With the Pagnator Component

If you wanted to sort a Model by a certain field in this case take the field “created” which is a date. We can simply tell cakePHP to pagnate entries by the order they were created by the following example.

	public function index() {
		
		// we prepare our query, the cakephp way!
		$this->paginate = array(
			'limit' => 20,
			'order' => array('created' => 'desc')
		);
		
		
		$this->Link->recursive = 0;		
		$this->set('links', $this->Paginator->paginate());
	}

More Examples can be found here;
https://www.codeofaninja.com/2013/07/pagination-in-cakephp.html