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

[eluser]TheFuzzy0ne[/eluser]
You have some serious errors in your model. Firstly, there are two return statements. A return statement makes the function return back to the caller, so the second one will never be reached. Also, unless it's in an if statement, it's pointless having one in an foreach statement.

As you're only expecting a single row, you don't need to use a foreach statement.

Here's a version of your code that may work:
Code:
<?php
function twitter_info_public($username)
{
    $this->db->where('username', $username); // Set the WHERE condition
    $query = $this->db->get($this->table)->row; // Return the result row
}

function index()
{
    
    if ( ! $this->uri->segment(3))
    {
        // Then there's no third segment, so do something here.
    }
    else
    {
        $this->load->model('profile'); // Load the model.
        $ti = $this->profile->twitter_info_public(); // Get the data from the model method
        
        
        $this->load->library('twitter'); // Load the library
        
        $config = array(
                'userid'            => $ti->twitterid, // Variables won't work in single quotes.
                'username'          => $ti->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
        
        ...
The above code is untested.

I've made a lot of guesses and assumptions here, so don't expect the code to work, but it should get you started.


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