Welcome Guest, Not a member yet? Register   Sign In
Fix an anchor issue
#1

Hello all!

I uploaded code from git into my site but having an issue anchoring the controller to view. This is my anchor:
<?= anchor('chat/index','Chat');?>


This is the controller/function that Im trying to connect:

class Chat extends Controller {

    function Chat() {
        parent::Controller();
        $this->load->database('cultured_codeignite');
        $this->load->model('mod_chat');
        $this->load->library(array('session', 'authentication'));

    }

    function index() {
        //outsiders keep out
        $this->authentication->sentry();
        $ctr = 0;
        //get all chat messages from buddy
        $username = $this->session->userdata('username');
        $recipient = $this->session->userdata('recipient');
        $fetchchat = $this->mod_chat->fetchchat($username, $recipient);
        $chatreverse = '';
        //reverse results of chat, bottom message is latest
        foreach ($fetchchat as $chatorig) {
            $chatreverse[$ctr]['username'] = $chatorig->username;
            $chatreverse[$ctr]['message'] = $chatorig->message;
            $time = explode(' ', $chatorig->time);
            $reformat_time = date("g:i a", strtotime($time[1]));
            $chatreverse[$ctr]['time'] = $reformat_time;
            ++$ctr;
        }
        $data['chat'] = '';
        $data['buddy'] = $this->session->userdata('recipient');
        $buddyimage = $this->mod_chat->get_buddy_image($this->session->userdata('recipient'));
        $data['buddyimage'] = $buddyimage[0]->image;
        //throw messages to view
        if (is_array($chatreverse)) {
            $users['username'] = $username;
            $users['recipient'] = $recipient;
            $this->mod_chat->message_read($users);
            $data['chat'] = array_reverse($chatreverse);
        }
        $this->load->view('view_chat', $data);
    }


The viewer is view_chat that Im trying to connect to. How do I get this to work?

Heart Heart ,
Mekaboo
Reply


Messages In This Thread
Fix an anchor issue - by Mekaboo - 06-24-2019, 09:02 PM
RE: Fix an anchor issue - by php_rocs - 06-24-2019, 10:10 PM
RE: Fix an anchor issue - by Mekaboo - 06-25-2019, 11:07 AM
RE: Fix an anchor issue - by InsiteFX - 06-25-2019, 03:46 AM
RE: Fix an anchor issue - by Mekaboo - 06-25-2019, 11:09 AM
RE: Fix an anchor issue - by php_rocs - 06-25-2019, 10:10 PM
RE: Fix an anchor issue - by Wouter60 - 06-25-2019, 10:11 PM
RE: Fix an anchor issue - by Mekaboo - 06-26-2019, 12:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB