0

Anytime i attempt to load sparks i cant load the libraries, Its almost as if HMVC has broken the loading of sparks.

An example:

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

class Index extends MX_Controller {
    function __construct(){
        parent::__construct();
        $this->load->spark('template/1.9.0');
        $this->load->library('template');       
    }
    public function index(){
        $this->template
             ->title('TSET123')
             ->build('index/index');
    }
}

causes: Unable to load the requested class: template

i have attempted following these instructions over @ getsparks.org: http://getsparks.org/set-up-mx

but its still not working, any ideas?

Using:

  • HMVC Latest
  • CI 2.1.x (tried 1.0 and 1.1)
  • Latest Sparks
NDBoost
  • 10,184
  • 6
  • 53
  • 73

3 Answers3

3

I have managed to make (assets and template) sparks library to work with HMVC, but be sure that other spark libraries will not work as it should ( since i also tried ion_auth and it didnt work ).

  1. first of all you have to have a fresh HMVC installation then you
  2. will have to install sparks but dont overwrite the MX loader nor the MX module files
  3. get the MY_Loader file from sparks extend it from MX_Loader not from CI_Loader like this:

require APPPATH."third_party/MX/Loader.php";

class MY_Loader extends MX_Loader {
/*the MY_Loader code from getsparks.org*/}

you may like this simple code http://s.zah.me/IE0BQ4

MrWhite
  • 43,179
  • 8
  • 60
  • 84
Zaher
  • 1,120
  • 7
  • 18
1

After following all the steps described at http://getsparks.org/set-up-mx

Go to application/third_party/MX/Modules.php and change :-

define('SPARKPATH', APPPATH.'sparks/');

to

define('SPARKPATH', FCPATH.'sparks/');

OR

you can place your sparks folder inside applications directory

With this change, ion_auth and oauth2 sparks should work as well

Madhur
  • 2,119
  • 1
  • 24
  • 31
0

From the sample code

$this->load->spark('example-spark/1.0.0'); 
$this->example_spark->method();

I don't see any of sample like this ...

$this->load->library('something load via spark');

In your case should be ...

$this->template->some_method();
vee
  • 4,506
  • 5
  • 44
  • 81