Trying to get an existing CI model that pulls info from a database (do not want to make a fuel_model for it, since it's content that is read-only, and comes from another source).
Tried adding the model to fuel/application/views/_variables/training.php
inside, added the content:
<?php $vars['models'] = 'training_model';
The content can be pulled in a view (the fuel/application/views/_blocks/header.php
I cannot get this data to be show in a fuel CMS page. It pulls the body fuel_var('body', 'This is a default layout..
Is there any way to pass this data pulled into a given page in the CMS?
Comments
Create a page in the fuel/application/_variables with the same name as the URL. (training.php).
Include the model ($this->load->model('training_model');)
On the layouts, use the model as normal:
$something = $this->training_model->get_courses();
fuel_set_var('something', $something);
Then in the page, or the block, the variable $something is available.
It seems to work for me, maybe it's not the cleanest way, but it gets the job done.
http://docs.getfuelcms.com/general/opt-in-controllers
http://docs.getfuelcms.com/general/layouts (as discussed under Layouts As Their Own Class Files)