Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter CRUD View Abstraction
    primarykey
    data
    text
    <p>I'm building a CMS using <a href="http://codeigniter.com/" rel="nofollow">CodeIgniter</a> and I'm stumped on the best way to go about handling the various CRUD views. Given that my URL is similar to...</p> <p>mydomain.com/admin/app/content/pages/edit</p> <p>...where 'admin' is my controller and 'app' is my action method, I currently map segments 3, 4, and 5 to actual directories/files, like so:</p> <pre><code>/views /admin /content /pages list_view.php edit_view.php add_view.php /banners list_view.php edit_view.php add_view.php </code></pre> <p>One caveat is that I need to call different non-CRUD model methods depending on which page is being called, so my app() action method is starting to have have a nasty if..else block. Also, each section's views are going to look different, because of different table data, so I don't see how I can avoid having a bunch of view pages. Obviously the downside of all this is that 1) I'm repeating a lot of code, and 2) if I add a new admin section I have to physically make a slew of new directories and add a new portion to the if...else block.</p> <p>So my questions are:</p> <ol> <li>How can I reduce the number of directories and view pages I'm creating?</li> <li>Can <a href="http://codeigniter.com/user_guide/database/fields.html" rel="nofollow">list_fields() or field_data()</a> methods lend itself to any automation?</li> </ol> <p>One idea I had was to profile the table I'm interacting with, create a dynamic associative array that defines which fields I want to expose as well as the type of form element it should be, and then pass that off to a common view. Thoughts? Flaws?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload