Search Results

Search found 4 results on 1 pages for 'askkirati'.

Page 1/1 | 1 

  • How to load models in the extended MY_Router class in codeigniter

    - by askkirati
    I am not able to load models to the extended My_Router class in codeigniter. Below is my code: class MY_Router extends CI_Router { function MY_Router() { parent::CI_Router(); } function _validate_request($segments) { // Does the requested controller exist in the root folder? if (file_exists(APPPATH.'controllers/'.$segments[0].EXT)) { return $segments; } // Is the controller in a sub-folder? if (is_dir(APPPATH.'controllers/'.$segments[0])) { // Set the directory and remove it from the segment array $this->set_directory($segments[0]); $segments = array_slice($segments, 1); if (count($segments) > 0) { // Does the requested controller exist in the sub-folder? if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT)) { show_404($this->fetch_directory().$segments[0]); } } else { $this->set_class($this->default_controller); $this->set_method('index'); // Does the default controller exist in the sub-folder? if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT)) { $this->directory = ''; return array(); } } return $segments; } // Let's check if there are category segments $category_routes = $this->category_routing($segments); if($category_routes !== FALSE) { return $category_routes; } $user_routes = $this->user_routing($segments); if($user_routes != FALSE) { return $user_routes; } show_404($segments[0]); } function category_routing($segments) { $this->load->model('category_model'); if($this->category_model->category_exist($segments[0])) { //if only category if(count($segments)==1) { return array('category', 'category_browse', $segments[0]); } //category pagination if(count($segments)==2 and is_numeric($segments[1])) { return array('category','category_browse', $segments[0], $segments[1]); } //category upcoming if(count($segments)==2 and $segments[1] == 'upcoming') { return array('category','upcoming', $segments[0]); } //category upcoming pagination if(count($segments)==3 and $segments[1] == 'upcoming' and is_numeric($segments[3])) { return array('category','upcoming', $segments[0], $segments[3]); } //category top if(count($segments)==3 and $segments[1] == 'top') { return array('category','top', $segments[0], $segments[2]); } //category top pagination if(count($segments)==4 and $segments[1] == 'top' and is_numeric($segments[3])) { return array('category','top', $segments[0], $segments[3]); } } return FALSE; } function user_routing($segments) { $this->load->model('dx_auth/users', 'user_model'); if($this->user_model->check_username($segments[0])) { //only profile if(count($segments)==1) { return array('user','profile',$segments[0]); } //all friends if(count($segments)==2 and $segment[1]=='allfriends') { return array('user','allfriends',$segments[0]); } //all subscribers if(count($segments)==2 and $segment[1]=='allsubscribers') { return array('user','allsubscribers',$segments[0]); } //all subscription if(count($segments)==2 and $segment[1]=='allsubscriptions') { return array('user','allsubscriptions',$segments[0]); } } return FALSE; } } I have tried loading the models by using get_instance function provided by codeigniter but seems like it doesnot work. All i need is load the models in extended system library.

    Read the article

  • using joins or multiple queries in php/mysql

    - by askkirati
    Here i need help with joins. I have two tables say articles and users. while displaying articles i need to display also the user info like username, etc. So will it be better if i just use joins to join the articles and user tables to fetch the user info while displaying articles like below. SELECT a.*,u.username,u.id FROM articles a JOIN users u ON u.id=a.user_id OR can this one in php. First i get the articles with below sql SELECT * FROM articles Then after i get the articles array i loop though it and get the user info inside each loop like below SELECT username, id FROM users WHERE id='".$articles->user_id."'; Which is better can i have explanation on why too. Thank you for any reply or views

    Read the article

  • getting posts from other site network in wordpress 3.0

    - by askkirati
    hello, i have set up the new wordpress 3.0 with multisite network capabilities. What i want to do is get and show blogs from other network site in the main blog. Like if i have set up the blog at example.com and i have other network sites at articles.example.com, movies.example.com. I want to get the posts from the articles.example.com and movies.example.com to show up in the main site at example.com. Is there any parameter in query_post to get the post from different network sites?

    Read the article

1