Front end views via CMS, best practice for record sets and data display - newbie

edited September 2013 in Share
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.

Comments

  • edited 3:07AM
    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(); //$CI->load->model('projects_model'); //$projects = $CI->projects_model->find_all(); foreach($projects as $project) : echo $project->name; endforeach;
  • edited 3:07AM
    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?
  • edited 3:07AM
    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:
    http://docs.getfuelcms.com/libraries/my_model
    http://docs.getfuelcms.com/general/models
Sign In or Register to comment.