Search code examples
phpformscodeigniterformhelper

Create file with all from associative arrays and call it?


I was reading the documentation of Codeigniter and I didn't found the way to create a php file with all the associative arrays that I will use in my web system and the way to call them, I don't like to have a huge code in the views files so I want to know if it is possible and the proper way to do it.

Thanks in advance guys!

edited

I want to do something like this:

dir config/array_forms.php

$input = array("name" => "MyInput", "id" => "MyInput", class="MyClass");
$another_input = array("name" => "another_input", id="another_input", class="MyClass");

dir views/formview.php

//Way to make a call to the file with the arrays

$form_label("Input Label:");
$form_input($input);
$form_label("Another Input Label:");
$form_input($another_input);

Solution

  • I realize how can do it and is so simple, you must have to create a view with all the associative arrays, and then load the view in your controller. It's a Simple way to solve it.

    Thanks to all for your collaboration.