Thursday, August 30, 2012

Re: regarding using dynamic table name in controller function

Hello friends,

Try below action

function abc($table_name)
{
   $model_name = Inflector::classify($table_name)

   App::Import('Model', $model_name);
   $this->DynamicModel = new $model_name;

   $table_field=$this->DynamicModel->find('all');
   $this->set('$table_field' ,$table_field);

}


--
Thanks & Regards

Chetan Patel

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

No comments: