Passing custom model function data through _variables

edited May 2012 in News & Announcements
Hi!

Can anybody tell me if it is possible to pass the results of a custom model function (ex.: femaleSubscirbers($state) in the "subsribers" model) through to a view using the _variables file?

I can get information out using the fuel_model() function but I'd like to use the custom function and I can't figure out how to do it or if it's even possible. I'm used to the CI way of using models but I like the opt-in controller philosophy of Fuel...

Thanks

Comments

  • edited 11:25AM
    ...Or is there a way to pass the results from femaleSubscribers($state) through by using fuel_model()?
  • edited 11:25AM
    You can still load in your models in your variable files like so:
    $CI =& get_instance(); // $CI may already exist and you may not need to do this $CI->load->model('subscribers'); $data = $CI->subscribers->femaleSubscribers($state); ...
  • edited 11:25AM
    Thanks for your fast response admin.

    I tried it and got:
    Unable to locate the file: subscribers.php

    So I tried changing the subscribers to subcribers_model and got:
    Fatal error: Uncaught exception 'Exception' with message 'Method femaleSubscribers does not exist.' in C:\wamp\www\1-durapac\fuel\application\core\MY_Model.php on line 2322
    ( ! ) Exception: Method femaleSubscribers does not exist. in C:\wamp\www\1-durapac\fuel\application\core\MY_Model.php on line 2322

    I must be missing something obvious, again... :-\ Any ideas?
  • edited 11:25AM
    My bad... My method was outside of the table class! Oh what mischief can be caused by a wayward curly brace...

    Works like a charm, admin. Thxs
Sign In or Register to comment.