Welcome Guest, Not a member yet? Register   Sign In
Controller Recieving Errors
#1

[eluser]xtremer360[/eluser]
I have the controller itself loading properly however I don't think I have my controller written correctly according to the documentation for the wiredesignz moduler extentions codeigniter framework plugin. Reason I'm saying I might not have written it properly is because I'm receiving plenty of errors.

Errors:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI::$data

Filename: MX/Controller.php

Line Number: 58
A PHP Error was encountered

Severity: Notice

Message: Indirect modification of overloaded property Quotes::$data has no effect

Filename: controllers/quotes.php

Line Number: 71

https://bitbucket.org/wiredesignz/codeig.../wiki/Home

Here's my controller:

Code:
<?php

if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
* Quotes
*
* @package KOW Manager
* @author Jeffrey Davidson
* @version 1.0.0
* @copyright 2012
*/
class Quotes extends MX_Controller
{

    public function __construct()
    {
        parent::__construct();
        $this->load->library('kowauth');
        
    }

    public function index()
    {
        //Config Defaults Start
        $msgBoxMsgs = array(); //msgType = dl, info, warn, note, msg
        $cssPageAddons = ''; //If you have extra CSS for this view append it here
        $jsPageAddons = ''; //If you have extra JS for this view append it here
        $metaAddons = ''; //Sometimes there is a need for additional Meta Data such in the case of Facebook addon's
        $siteTitle = ''; //alter only if you need something other than the default for this view.
        //Config Defaults Start


        //examples of how to use the message box system (css not included).
        //$msgBoxMsgs[] = array('msgType' => 'dl', 'theMsg' => 'This is a Blank Message Box...');

        /**********************************************************Your Coding Logic Here, Start*/

        // Checks to see if a session is active for user and shows corresponding view page
        if ($this->kowauth->isLoggedIn())
        {
            $bodyContent = "testing"; //which view file
        }
        else
        {
            redirect('login', 'refresh');
        }
        $bodyType = "full"; //type of template

        /***********************************************************Your Coding Logic Here, End*/

        //Double checks if any default variables have been changed, Start.
        //If msgBoxMsgs array has anything in it, if so displays it in view, else does nothing.
        if (count($msgBoxMsgs) !== 0)
        {
            $msgBoxes = $this->msgboxes->buildMsgBoxesOutput(array('display' => 'show',
                'msgs' => $msgBoxMsgs));
        }
        else
        {
            $msgBoxes = array('display' => 'none');
        }

        if ($siteTitle == '')
        {
            $siteTitle = $this->metatags->SiteTitle(); //reads
        }

        //Double checks if any default variables have been changed, End.

        $this->data['msgBoxes'] = $msgBoxes;
        $this->data['cssPageAddons'] = $cssPageAddons; //if there is any additional CSS to add from above Variable this will send it to the view.
        $this->data['jsPageAddons'] = $jsPageAddons; //if there is any addictional JS to add from the above variable this will send it to the view.
        $this->data['metaAddons'] = $metaAddons; //if there is any addictional meta data to add from the above variable this will send it to the view.
        $this->data['pageMetaTags'] = $this->metatags->MetaTags(); //defaults can be changed via models/metatags.php
        $this->data['siteTitle'] = $siteTitle; //defaults can be changed via models/metatags.php
        $this->data['bodyType'] = $bodyType;
        $this->data['bodyContent'] = $bodyContent;
        $this->data['userData'] = $this->users->getUserByUserID($this->session->userdata('userID'));
        $roster = $this->kowauth->getRosterList($this->data['userData']->usersRolesID);
        $userRoster = array();
        foreach ($roster AS $member)
        {
            $userRoster[$member->id] = $member->rosterName;
        }
        $this->data['userRoster'] = $userRoster;
        $this->data['personalMessages'] = array($this->pmmodel->
            getInboxUnreadMessagesCount($this->session->userdata('userID')), $this->pmmodel->
            getInboxMessagesCount($this->session->userdata('userID')), $this->pmmodel->
            getLast5Messages($this->session->userdata('userID')));
        $this->load->view('cpanel/index', $this->data);
    }
}

/* End of file quotes.php */
/* Location: ./application/modules/bios/controllers/quotes.php */
#2

[eluser]Samus[/eluser]
Hmm only thing I can see is you have no $data property.

Yet you're trying to use one '$this->data' ?

You're also getting an error from your parent controller, so check that too.
#3

[eluser]xtremer360[/eluser]
Parent controller?
#4

[eluser]Samus[/eluser]
[quote author="xtremer360" date="1334520368"]Parent controller?[/quote]
You're extending MX_Controller, which is the Quotes controller's parent..
#5

[eluser]xtremer360[/eluser]
Have you used this plugin before?
#6

[eluser]xtremer360[/eluser]
Hmm that's odd if I change MX to CI it works just fine. I thought on the docs for this plugin that you are supposed to use MX controller though.
#7

[eluser]Samus[/eluser]
[quote author="xtremer360" date="1334520696"]Hmm that's odd if I change MX to CI it works just fine. I thought on the docs for this plugin that you are supposed to use MX controller though. [/quote]

If you wanted to extend the default functionality of controllers you can create a controller in applications/core and give it a class name of 'MY_Controller'.

But if you just need normal functionality, CI_ is what you'd use.
#8

[eluser]xtremer360[/eluser]
Okay thank you for the clarification.




Theme © iAndrew 2016 - Forum software by © MyBB