Posts

Showing posts from June, 2011

How to write a where query in cakephp?

write a where query in cakephp    $var = $this->module->find('all',array('conditions' =>array('name' => 'xyz')));    this->set('user',$var); Note:- where 'all' is putting all field from table; you can replace 'all' by single field name also; 'name => xyz' is condition of query in cake php; 'user' is a variable which you will use in view folder for a page; // example: foreach($user as $users) in index.php

How to setup a 301 Redirect in php

A 301 HTTP response status code is a way of telling search engines that a page, pages, directory or entire website has been permanently moved to another place on the web. This is very useful if you have changed the structure of your websites url’s or if you have moved domain. You can also redirect your entire site. Whereas a 301 code tells search engines that something has been permanently moved , a 302 code tells search engines that something has been temporarily moved . This is useful if you only want to redirect a page for a short period of time. To do a 302 redirect simply change the 301 part to 302. You can also use 303, which is means ’seeother’ and the page has been replaced by something else. Again, to do this simply substitute 301 with 303 in the tutorials below. How to setup a 301 Redirect The basic code for redirecting is : Redirect 301 old_location new_location   The old location of the file has to be the absolute path from the root of your server. The new