ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Problems creating and using libraries!!!

September 16, 2014 12:27pm

Subscribe [0]
  • #1 / Sep 16, 2014 12:27pm

    hd209458

    1 posts

    Hi everyone!

    I’m developing an application, and have some problems using the libraries i’m creating.
    Details below:

    .:::. Inside /application/libraries/ folder i have to files:

    Soap.php

    <?php
    
    if (!defined('BASEPATH'))
        exit('No direct script access allowed');
    
    class Soap extends CI_Controller {
        public function __construct() {
            parent::__construct();
        }
    
        public function getAlgo() {
            return "algo";
        }
    
    }


    Demo.php

    <?php
    
    if (!defined('BASEPATH'))
        exit('No direct script access allowed');
    
    class Demo extends CI_Controller {
        public function __construct() {
            parent::__construct();
        }
    
        public function getDemo() {
            return "Demo";
        }
    
    }

    .:::. Inside /application/controllers/ folder i have a controller:

    sce.php

    <?php
    
        if (!defined('BASEPATH'))
            exit('No direct script access allowed');
    
        class Sce extends CI_Controller {
    
            public function __construct() {
                parent::__construct();
                $this->load->helper('url');
                $this->load->library('session');
                $this->load->library('encrypt');
                $this->load->library('soap');
                $this->load->library('demo');
            }
    
            public function showSCE() {
                echo $this->soap->getAlgo();
                echo $this->demo->getDemo();
            }
    
        }
    
        ?>


    :::. Executing: http://localhost/app_demo/index.php/sce/showSCE

    A PHP Error was encountered

      Severity: Notice
      Message: Undefined property: Sce::$demo
      Filename: controllers/sce.php

      Fatal error: Call to a member function getDemo() on a non-object in
      C:\xampp\htdocs\app_demo\application\controllers\sce.php on line xx

     

    .:::. This error shows up when I use the two libraries, but if i only use one works !!!!!. Someone who can help me?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases