Category Archives: Newbie
SEO based urls : CodeIgniter routes
You can use this code for SEO urls //this section enables you to use some controllers $route[’admin/(:any)’] = "admin/$1"; $route[’contact/(:any)’] = "contact/$1"; $route[’auth/(:any)’] = "auth/$1"; $route[’testimonials/(:any)’] = "testimonials/$1"; //else everything in url will handle by this pro controller’s … Continue reading
A Tip in codeigniter to join two tables have same coloum name id
A Tip in codeigniter to join two tables have same coloum name id $this->ci->db->select("users.*", FALSE); $this->ci->db->select("user_profile.*", FALSE); $this->ci->db->from("users"); $this->ci->db->join("user_profile", "user_profile.user_id = users.id",’inner’); $this->ci->db->where(array(’users.id’=>$user_id), NULL, FALSE); Users table has id and other table User_profile have id and user_id now users’s id … Continue reading
true v/s TRUE is actually case insensitive : PHP Tips
Fact is : To specify a boolean literal, use the keywords TRUE or FALSE. Both are case-insensitive. We assume in moodle: http://docs.moodle.org/en/Development:Coding_style#Booleans_and_the_null_Value Booleans and the null Value Use lower case for true, false and null. We assume in CodeIgniter: http://codeigniter.com/user_guide/general/styleguide.html#true_false_and_null … Continue reading
My CodeIgniter .Htaccess
This is my .htaccess file RewriteEngine on RewriteCond $1 !^(index\.php|images|user_guide|assets|captcha|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L] It should be placed in root of the website. Rewrite module of apache should be enabled or it will give you an 500 internal server error. … Continue reading
PHP comment style
There are three ways of PHP commenting… #some single line comment in php //Another way of single line commenting in php /* some multiline commenting */
Ending tags of php – leave or not
To end the php code we can use <? , In fact it is just optional and we should leave it when we are following OOP. This helps us to remove unwanted whitespaces. This is the core rule of Codeigniter … Continue reading