Frage

How can I load a module in Codeigniter with a special short name? something like this:

$this->load->module('LongModuleName', 'ShortName');

So that I can access module with:

$this->ShortName...
War es hilfreich?

Lösung

You would have to update the Thirdparty/MX/Loader.php

to look something like this:

/** Load a module controller **/
public function module($module, $params = NULL, $shortname=NULL)    {

    if (is_array($module)) return $this->modules($module);

if(isset($shortname))
  $name = $shortname;
  else
  $name = $module;

    $_alias = strtolower(basename($name));
    CI::$APP->$_alias = Modules::load(array($module => $params));
    return CI::$APP->$_alias;
}

Then to use it you would call:

$this->load->module('LongModuleName', NULL ,'Shortname');

The reason for the second parameter being null, is because this is looking for parameters

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top