Front end views via CMS, best practice for record sets and data display - newbie
  • I have been navigating Fuel 1.0 documentation and tutorials to understand the recommended way to populate data saved in CMS and i am confused. Please advise because there are multiple ways to setup model > view. for example in my case Projects and/or Categories filtered records.
  • So you are needing a view file that displays project record information? If so, create a view file and add something like:
    $projects = fuel_model('projects');
    //the above is the equivalent to the following:
    //$CI =& get_instance();
    //$projects = $CI->projects_model->find_all();

    foreach($projects as $project) :
    echo $project->name;
  • Ok just to confirm, does it matter if i am querying a view vs table? For example i am using mysql views to allow simpler queries, so in this case i have combined view of Projects list with their categories. But just realized that maybe Fuel may not see it the same way. Should this affect anything?
  • I'm not certain at this point. If you can get it working with CI, then chances are it will work in FUEL as well. If you do a query using CI, you can use the $this->projects_model->get() method or $this->projects_model->map_query_records() method to wrap the results in custom Data record objects. Here is some additional documentation on Models if you haven't already read it:

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!