Welcome Guest, Not a member yet? Register   Sign In
Two functions, one shared view and plenty of fields. Trying to DRY my code
#2

I would just create a method for setting them like below, I do not know what
type fields you are using (int string etc; So just a generic method.


PHP Code:
/**
 * call ( $params = $this->setParams($view, $action, $title, $content);
 */
private function setParams($view$action$title$content)
{
 
   $params = [
 
       '_view'   => $view,
 
       'action'  => $action,
 
       'title'   => $title,
 
       'content' => $content,
 
   ];

 
   return $params;

 
Hope that helps.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Two functions, one shared view and plenty of fields. Trying to DRY my code - by InsiteFX - 04-13-2019, 05:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB