Welcome Guest, Not a member yet? Register   Sign In
Using functions set in a model? [SOLVED]
#1

[eluser]Schneider707[/eluser]
I created a model which fetches two pieces of info from a row and saves them to variables. How would I be able to use those variables in my controller? I see the example in the userguide of how to pass them to a view, but I don't think that would work for me.


Here is the model.
Code:
function twitter_info_public()
      {
        $user = $this->uri->segment(1);
        $this->db->where('username', $user);
        $query = $this->db->get($this->table, 1);
            if($query->num_rows() == 1)
            {
                 foreach ($query->result_array() as $row)
                   {            
                    return $twitterid = $row['twitter_id'];
                    return $twittername = $row['twitter_name'];
                }
            }
        
      }
And here is the controller...well part of it
Code:
function index()
    {
        $this->load->library('twitter');
         $this->profile->twitter_info_public();
        $config =     array(
        'userid'            => '$twitterid',
        'username'            => '$twittername',
        'type'                => 'mine',
        'num'                => 5,
        'rss_cache_path'    => APPPATH.'cache/twitter-rss-cache',
        'cache_time'        => 300 // 5 minutes
        );
        // example for organikdesigns  = http://twitter.com/statuses/user_timeline/16020929.rss"
        // $config['type'] can be 'mine' (just your own tweets),
        // or 'social' (includes people you follow)
        
        $this->twitter->init($config);

See where $twitterid and $twittername is? Thats what im working on. I know its gotta be something like $this->load->vars or something...I just can't seem to find a question like mine.

Ty for the help =)


Messages In This Thread
Using functions set in a model? [SOLVED] - by El Forum - 02-21-2009, 01:24 PM
Using functions set in a model? [SOLVED] - by El Forum - 02-21-2009, 01:59 PM
Using functions set in a model? [SOLVED] - by El Forum - 02-21-2009, 02:36 PM
Using functions set in a model? [SOLVED] - by El Forum - 02-21-2009, 02:47 PM
Using functions set in a model? [SOLVED] - by El Forum - 02-21-2009, 02:49 PM
Using functions set in a model? [SOLVED] - by El Forum - 02-21-2009, 02:51 PM
Using functions set in a model? [SOLVED] - by El Forum - 02-21-2009, 03:00 PM
Using functions set in a model? [SOLVED] - by El Forum - 02-21-2009, 06:58 PM
Using functions set in a model? [SOLVED] - by El Forum - 02-21-2009, 07:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB