Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - Version 4.3

[eluser]dmitrybelyakov[/eluser]
Hi again!

It is my great regret that we have to modify application structure in order to use the new versions of this great contribution.Anyway I now try to study the new version from scratch and here what i discovered:

Running (in module constructor):
Code:
$this->load->language("admin", "anylanguage");

Gives:

Fatal error: Call to undefined function array_modulerge() in ...\system\application\libraries\Controller.php on line 312

[eluser]wiredesignz[/eluser]
Yes, that is a typo due to a global text replacement. It occurs in 3 places in Controller.php, Please alter the code to read `array_merge`. Thanks.

[eluser]dmitrybelyakov[/eluser]
Strange behavior of modules::run

I don't want to annoy you with my questions but there's another problem i discovered that i just can't fix.

Background:

I am using the _remap function in my default controller(module) that handles URI parsing running the appropriate module.
The module then returns its content and default controller outputs it all to a view.

Like this:

Code:
$data['page_title']="Page title";
$data['content']=modules::run($module_path);
$this->load->view('container', $data);

Pretty simple, right? But as soon as i run:: a module it changes the path to views.

So in my container view this:
Code:
$this->load->view("html-header");
no longer works.

Am i somehow breaking your logic?

[eluser]wiredesignz[/eluser]
Asking is good, I need feedback to improve Modular Extensions and fix bugs. Wink

I'm assuming you use version 4.0 for this. (4.1 is similar).

When you load a module view it will scan directories in the module/views and application/views paths.

Could you post the exact path to your html-header view and also the error you see. Thanks.

[eluser]dmitrybelyakov[/eluser]
Ok that's correct but i think there's still a strange behavior of modules::run method.

Here's what you asked for: My default module is admin. So the folder structure is like this:

[pre]
/modules/admin/
/controllers/admin.php
/views/container.php
/views/html-header.php
/views/html-footer.php


/modules/dashboard/
/controllers/dashboard.php
/views/dashboard.php
[/pre]


In my admin module i have a function that collects all the data and outputs it to container.php view:

Code:
function runModule($module_path){        
    $data['content']=modules::run($module_path); //comment this line to work            
    $this->load->view('container', $data);          
    }

And the /admin/views/container.php looks like this:

Code:
$this->load->view("html-header");
echo $content;
$this->load->view("html-footer");


This does not work as it should and i am getting a CI error:


An Error Was Encountered
Unable to locate the requested file: admin/views/html-header.php

[eluser]wiredesignz[/eluser]
Personally I don't recommend using $this->load->view inside a another view because CI_Loader behaves differently between PHP4 and PHP5. (Loader is part of the Controller in PHP4, and a seperate object in PHP5).

Could you try this:
Code:
//admin module
$data['header']  = $this->load->view('header');
$data['content'] = modules::run($module_path);
$data['footer']  = $this->load->view('footer');

return $this->load->view('container', $data);

//container
echo $header;
echo $content;
echo $footer;

[eluser]marios[/eluser]
I just upgraded from version version: 4.0.26 to version: 4.0.31 and I get an error when I am using the pagination library when initialized.
I changed the library function in the modules_extention.php
from
<code>
function library($library, $params = FALSE)
</code>
to
<code>
function library($library, $params = NULL)
</code>
I am not sure if this breaks anything but since it overwrites CI_Loader the function definition should be the same.

[eluser]wiredesignz[/eluser]
Yep that is a bug. Thanks Marios Wink

I will post an updated version to the wiki soon.

[eluser]sikkle[/eluser]
good catch there. again wired, good job !

[eluser]wiredesignz[/eluser]
Thanks sikkle, Your support and help is greatly appreciated. Wink

Version 4.0.32 (bugfix) is available on the wiki. Thanks Marios.

Version 4.1.06 of the new Modular Extensions is also available on the wiki.

As always your feedback is appreciated.




Theme © iAndrew 2016 - Forum software by © MyBB