Welcome Guest, Not a member yet? Register   Sign In
default_controller+ matchbox
#1

[eluser]brain_74[/eluser]
Hi guys,

only me, have this problem? :-)

I use Matchbox 0.9.4.

I don't use mod_rewrite.

I have this structure inside application folder:

- modules
- admin (1)
- controllers (2)
- c_admin.php (3)
- models (2)
- m_admin.php (4)
- view (2)
- v_admin.php (5)

(1) - module folder
(2) - folder
(3) - controller
(4) - model
(5) - view

My problem is in the $route['default_controller']...

-----

if I use this $route['default_controller']="modules/admin/controllers/c_admin";

the result is:

"An Error Was Encountered
Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid."

-----

if I use this $route['default_controller']="admin/controllers/c_admin";

the result is:

404 Page Not Found The page you requested was not found.

Any idea?


There is anyone that can put an example with matchbox to download on http://code.google.com/p/matchbox?

And not only the source code?

Tks a lot for any reply!

"Ciao" from Florence(Italy) :-)
#2

[eluser]zdknudsen[/eluser]
You shouldn't use the actual path to the controller, but the 'default uri' instead. Smile So if you want the default controller to be the one located in "modules/admin/controllers/c_admin", you should instead just use.

Code:
$route['default_controller'] = "admin/c_admin";

That is, the uri you would use to reach the specific controller. You can even add a method to the default controller route.
#3

[eluser]brain_74[/eluser]
Tks a lot Zacharias! :-)

Last thing... to autoload the model m_admin.php (4)

- modules
- admin (1)
- controllers (2)
- c_admin.php (3)
- models (2)
- m_admin.php (4)
- view (2)
- v_admin.php (5)

(1) - module folder
(2) - folder
(3) - controller
(4) - model
(5) - view

Is it correct?

$autoload['model'] = array(???);

Tks again ;-)
#4

[eluser]zdknudsen[/eluser]
Then you'd write
Code:
$autoload['model'] = array('module_name' => 'model_name');

Which means in your case it would be
Code:
$autoload['model'] = array('admin' => 'm_admin');
#5

[eluser]brain_74[/eluser]
Tks a lot Zacharias ;-)

If a day you will come in Italy (Florence) will offer to you a pizza + beer ;-)

Bye
#6

[eluser]brain_74[/eluser]
Zacharias, sorry if I disturb you again...
I think... is it possibile put also assets => JS, img etc... inside a module?
For example:

- modules
- admin (1)
- controllers (2)
- c_admin.php (3)
- models (2)
- m_admin.php (4)
- view (2)
- v_admin.php (5)
- js (2)
- admin.js (6)

(1) - module folder
(2) - folder
(3) - controller
(4) - model
(5) - view
(6) - assets

and load the assets via the controller:

function index()
{
...
...

$data['extraHeadContent'] .= '[removed][removed]';

// src="' . base_url() . 'admin.js" => which url I must write here?

$this->load->vars($data);
$this->load->module_view('admin','v_admin');
}

I hope you understand me :-)
#7

[eluser]brain_74[/eluser]
The system have removed something.. i rewrite these parts:

$data[extraHeadContent] = [removed][removed];
#8

[eluser]brain_74[/eluser]
Me again.. :-)

Is it possible call from a javascript file a controller inside a module?

For example:

// base url is a js variable in the global scope where I have printed inside it via php this => base_url();

function redirect()
{
var url= base_url + "my controller inside admin module"; ?????
[removed].href=url;
}

Tks again Zacharias :-)
#9

[eluser]zdknudsen[/eluser]
Whoa, hi again Smile

Well assets-wise, it's generally bad practice to store your assets with your application and/or system data, but if you wish to then go ahead, but there is no automated method for generating urls to your assets. Smile Hm, you could try writing a PM to pyromaniac on these boards, I've worked with him and he uses a library of his own that works with assets and Matchbox. Smile

In your last question, are you asking for a way to do AJAX calls? If so, do a google search on AJAX, it's a jungle man.

If you have further questions I encourage you to make new threads, as other people might have the same issues and won't be able to find the solutions if they are hidden in other threads with completely different titles. Wink

Best regards.
#10

[eluser]brain_74[/eluser]
Hi again Zacharias,

a really simple question here.

I am in
application/controllers/welcome.php

and I would like to load a model from a modules folder
application/modules/admin/models/

This method:
$this->load->model('someModel', 'someModel');

is not working... :-(

I have search in the forum before write to you...
but I don't find anything...

Tks a lot for any reply :-)




Theme © iAndrew 2016 - Forum software by © MyBB