Welcome Guest, Not a member yet? Register   Sign In
Modular Separation - PHP5 (Modules)

[eluser]dfreerksen[/eluser]
I'm having a horrible time getting hooks to pull things from the config file.

$CI =& get_instance();
$blah = $CI->config->item('base_url');

Will display an error on the page
Fatal error: Call to a member function item() on a non-object in ...

[eluser]Phil Sturgeon[/eluser]
[quote author="dfreerksen" date="1271280854"]I'm having a horrible time getting hooks to pull things from the config file.

$CI =& get_instance();
$blah = $CI->config->item('base_url');

Will display an error on the page
Fatal error: Call to a member function item() on a non-object in ...[/quote]

That is nothing to do with Modular Separation so this was a weird place to post your request.

What hook point are you using, as that makes a massive difference to what is available.

You might need to use $config =& load_class('Config'); if it is pre_controller.

[eluser]dfreerksen[/eluser]
I posted it here because it was working before I started using the Modular Separation. It worked both with and without HMVC. I thought it might be something with Modular Separation. I moved the hook for pre_controller to post_controller_constructor and it's working fine.

[eluser]All hail ci[/eluser]
greetings for all.

first of all, please apologize me for my bad-structured English.

i'm getting an error from loading more than one library when using Module Separation.

usually, i load a few libraries like this:
Code:
$this->load->library(array('session', 'table'));
but it returns error when Module Separation is installed:
Code:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: libraries/MY_Loader.php
Line Number: 99

A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: libraries/MY_Router.php
Line Number: 185

A PHP Error was encountered
Severity: Warning
Message: trim() expects parameter 1 to be string, array given
Filename: libraries/Loader.php
Line Number: 731

if I load the libraries 'one-by-one', it works:
Code:
$this->load->library('session');
$this->load->library('table');

anybody know how to fix this?
i've tried searching it, but no clues.
i'm using Codeigniter 1.7.2.
if there's a similar post, could you please pinpoint me to it?
thanks a lot before. Wink

[eluser]jonldavis[/eluser]
This looks like exactly what I need, as I'm setting up a web site consisting of a large number of "applications" (modules). I have a question about suggested best practice for routing, since routes can be altered either in application/config or in application/modules/myapp/config. Is it a good idea to include ANY module-specific routes in the main routes.php (perhaps to point CI to the appropriate controller), or put all the routing in the module-specific configs. My initial inclination is to move it all into the modules, so maybe the real question is: is it possible to do all the routing from the modules? My main index.php is basically nothing more than a menu for the various modules.

Any thoughts or comments would be welcome -- I don't expect everyone will agree on a single answer.

[eluser]Phil Sturgeon[/eluser]
[quote author="All hail ci" date="1271428955"]
i'm getting an error from loading more than one library when using Module Separation.

usually, i load a few libraries like this:
Code:
$this->load->library(array('session', 'table'));
but it returns error when Module Separation is installed:
Code:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: libraries/MY_Loader.php
Line Number: 99

A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: libraries/MY_Router.php
Line Number: 185

A PHP Error was encountered
Severity: Warning
Message: trim() expects parameter 1 to be string, array given
Filename: libraries/Loader.php
Line Number: 731

if I load the libraries 'one-by-one', it works:
Code:
$this->load->library('session');
$this->load->library('table');
[/quote]

I've added support for that, lets call it v1.12.

[quote author="jonldavis" date="1271816235"]This looks like exactly what I need, as I'm setting up a web site consisting of a large number of "applications" (modules). I have a question about suggested best practice for routing, since routes can be altered either in application/config or in application/modules/myapp/config. Is it a good idea to include ANY module-specific routes in the main routes.php (perhaps to point CI to the appropriate controller), or put all the routing in the module-specific configs. My initial inclination is to move it all into the modules, so maybe the real question is: is it possible to do all the routing from the modules? My main index.php is basically nothing more than a menu for the various modules.[/quote]

Routing within modules is not the same as routing at a global level. In the main routes.php you are setting the entire route, but within a module you are setting where requests already mapped to that module shout be routed to.

Tricky to explain, hope you understand that.

[eluser]All hail ci[/eluser]
[quote author="Phil Sturgeon" date="1271823564"]

I've added support for that, lets call it v1.12.
[/quote]

It Work's!!
thanks for the fix, Phil Sturgeon. It really helps.
Great Library!! Wink

[eluser]All hail ci[/eluser]
Hi, Phil Sturgeon.

'Pagination' library doesn't work correctly when i put my application inside modules directory.
for instances, i have 4 records on a table. i want to view them separately into 2 pages with 2 records each.
Code:
$config['base_url'] = base_url()."mod_usermanager/usermanager/show_users";
$config['total_rows'] = $this->show_users->count_users();
$config['per_page'] = 2;
$data['users'] = $this->show_users->list_users($config['per_page'], $this->uri->segment(4));
$this->pagination->initialize($config);
$this->load->view('userlist', $data);
echo $this->pagination->create_links();
the pagination links did shows, but when i clicked on the links for the second page results
the links for the second page should change or become unclickable, but it's not!
and the links for the 1st page is unclickable.
any solution for this?? or am I missing something?

i didn't get this kind of problem when i put my application outside the modules directory.

[eluser]Johan André[/eluser]
Try the $config['uri_segment'] setting it to the correct value.
Since your url is: mod_usermanager/usermanager/show_users it should be set to 4.

[eluser]All hail ci[/eluser]
[quote author="Johan André" date="1272320678"]Try the $config['uri_segment'] setting it to the correct value.
Since your url is: mod_usermanager/usermanager/show_users it should be set to 4.[/quote]
It Works! :lol:
haha.. thanks a lot, Johan André.
i'm sorry for missing this little thing.




Theme © iAndrew 2016 - Forum software by © MyBB