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

[eluser]wiredesignz[/eluser]
You can't use $this->load->module() inside a view. Instead check out the modules_helper
Code:
$result = modules::run('cl_auth', NULL, 'isValidUser');

[eluser]Delete Me Please[/eluser]
Thanks for the help! I got it all working Smile. Even with using the Template Class by Colin Williams. I never thought that would happen haha. It's 2:30am so I'm headed to bed. Thanks again Smile.

[eluser]Delete Me Please[/eluser]
Well I got it all ported over and everything works great Smile. Having a small problem though. I had to move all the config file arrays over to the main config file as I wasn't able to call any of the variables with $this->config->item('whatever'). I looked at the debug and it said that it was loading the module's config file but it still didn't work. Although, was I supposed to get the config variables like this $this->module_name->config->item('whatever')? Guess I should have tried that before I moved all them over heh.

Also, I see back on page 30-something of this post that you are able to have sub-directories in your views folder in your module directory. But you said something that the view files have to be named the same as the controller? Or is that the sub-directory has to be named the same as the controller? The reason I ask is I'm using views as templates for emails that get sent out and it would be nice to have them in a directory named 'email' in the views directory.

Anyways, thanks again for Modular Extensions. I'm really digg'n it!

[eluser]wiredesignz[/eluser]
Hi again,

You can load config items from modules however the module script creates a config sub-array for your items by default. (prevents your items from over-writing CI's)

To retrieve a config item you must also specify the config file name you loaded.
Code:
$this->config->item('item', 'filename');

Views in sub-directories is also possible, the sub-directory name must match the controller name.

Good luck. Wink

[eluser]sophistry[/eluser]
wired...

i'm having an issue with routing that i can't quite get under. can you please help?

i've got two modules i built - both of them i've posted here in this very thread :-) :

pages (for serving views as requested on the URI)
photobox (for a simple photogallery built from a directory of jpgs)

here is my routes.php file:
Code:
$route['default_controller'] = "pages";
$route['scaffolding_trigger'] = "";
// route everything to pages, except requests to photobox
$route['photobox/(.*)'] = "photobox/$1";
$route['(.*)'] = "pages/$1";

i want everything that is not photobox to go to pages. and everything that is targeting photobox to be passed along to it.

so, each of those "custom routes" works when i comment the other. but, when i have both active, the pages route works but the photobox one doesn't. it gives me a 404 and shows the server path as if it is looking for photobox *inside* the pages module (as if it were a view file!).

the problem seems to be in the _validate_request() method the MY_Router.php. take a look at the $segments array that is passed in when these two routes are active:
Code:
Array ( [0] => pages [1] => photobox )
it shows pages as the 0th array item! i suppose that is correct since it is the default_controller, but the code in the _validate_request() method really doesn't know what to do with that.

here, the method tries to use the 0th element as a path parameter.
Code:
/* locate the module controller */
        list($path, $file, $home) = $this->find($segments[1], $segments[0]);

i think that this method is making an assumption... but, i can't figure out what the assumption is. ;-)

can you take a look and let me know if you see something obvious.

thx.

EDIT: i just discovered that i can get it to work by adding a literal route first... but, i don't want to do that for every module. shouldn't it work without having to add two routes per "second tier" modules (the ones that aren't the main static site served up by the pages module)?
Code:
// route everything to pages, except requests for photobox
$route['photobox'] = "photobox";
$route['photobox/(.*)'] = "photobox/$1";
$route['(.*)'] = "pages/$1";

[eluser]wiredesignz[/eluser]
Hi Sophistry,

A single regex to catch anything `photobox` related would be like so:

Code:
$route['photobox(.*)'] = "photobox$1";

Hope this helps.

[eluser]sophistry[/eluser]
ok, well, that worked, but, how? i've never seen a regex omit the slash and re-embed it using the backreference.. i suppose i thought it wouldn't work so i never tried it. and i am pretty good with regex if i do say so myself. ;-)

my routing is specific but not that common i believe. i need to keep the exact urls from the *original static site* but serve them from the pages module. i don't want to set up 301 redirects or anything like that. i know that i can use multiple modules together without any custom routing, but i can't allow the pages module name to remain in the segment. so, i need this type of routing setup.

as i add more modules i'll just add a route like the one you suggested for every one. i can imagine reading the module directory and building my routes from that, but it is just easier for now to do it by hand.

thanks for the help.

[eluser]lizdeika[/eluser]
I have a problem with the latest(4.2) version and Redux Auth 1.4a
Here is what i have:
Code:
modules/
  users/
    config/
      redux_auth.php
    libraries/
      redux_auth.php
    controllers/
      users.php

users.php:
Code:
class Users extends Controller {

    function Users() {
        parent::Controller();
        $this->load->library('validation');
        $this->load->library('email');
        $this->load->library('redux_auth');
        
    }
        function index() {}
}

The result is:

An Error Was Encountered

The configuration file redux_auth.php does not exist.

Am i forced to move redux to application subdirs or am i missing something?

[eluser]wiredesignz[/eluser]
Redux Auth is a shared library not a module based library, move it (and its config) into the application/directories as per its installation instructions.

Welcome to CI forums.

[eluser]lizdeika[/eluser]
Then how should i load module config in module's libraries ?
Redux does that CI way:
Code:
$this->ci =& get_instance();
$this->ci->config->load('redux_auth');
What's whould be ME way?




Theme © iAndrew 2016 - Forum software by © MyBB