Welcome Guest, Not a member yet? Register   Sign In
need dynamic function name in controller
#1

Hi,

www.domain.com/cars/hyundai/grandi10

In this one cars is a controller and remaining parameter is dynamic.so how to write a controller for this..
Reply
#2

PHP Code:
class Cars extends CI_Controller
{
 
   public function hyundai($car_model)
 
   {
 
       // $car_model contains "grandi10"
 
   }


Read this for more info:
http://www.codeigniter.com/userguide3/ge...ur-methods
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#3

This may also be useful:
http://www.codeigniter.com/user_guide/ge...thod-calls

PHP Code:
public function _remap($method$params = array())
{
    
$carMake $this->getMake($method);
    
$carModel = empty($params) ? '' $this->getModel($params);
    
    
// do something now that you have the make and model

Reply




Theme © iAndrew 2016 - Forum software by © MyBB