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

[eluser]wiredesignz[/eluser]
Modular Separation - PHP5 version 1.09 is attached to this post.

Added $route['404'] routing to enable using a custom "Page not found" controller. Thanks Phil Sturgeon Wink

EDIT:
deprecated file removed
#52

[eluser]johnwbaxter[/eluser]
This is sexy, i'm gonna start using this now.

Nice action wiredesignz, thanks very much.
#53

[eluser]AgentPhoenix[/eluser]
I ported one of my projects from Modular Extensions to Modular Separation because is more in line with what I was looking. Love it so far, but I've run in to one small issue and after looking through the code couldn't find an obvious way to do it. I have a template that pulls files in dynamically, but when I use the first segment of the URI, it's my controller, not my module. How do I find out the current module I'm executing from?
#54

[eluser]wiredesignz[/eluser]
[quote author="AgentPhoenix" date="1259109351"]...How do I find out the current module I'm executing from?[/quote]

Code:
$this->router->fetch_module();
#55

[eluser]AgentPhoenix[/eluser]
Ugh. So simple. I feel stupid. Thanks, wired!
#56

[eluser]codex[/eluser]
[quote author="wiredesignz" date="1258003082"]Yes modules may contain a config/routes.php file.

The main difference from application routes, is that you set a default controller for a module like so:
Code:
$route['module'] = 'controller';
[/quote]

So, in application > config > routes.php there's
Code:
$route['default_controller'] = "welcome";

and in modules > welcome > config > routes.php there's
Code:
$route['welcome'] = "welcome"; // is this correct?
$route['test'] = "welcome/test";

When you go to /test you get a 404. What am I missing here?

EDIT: if you put the name of the controller before /test (welcome/test) then it works. Is this how it should work?
#57

[eluser]wiredesignz[/eluser]
[quote author="codex" date="1259181151"]... Is this how it should work?[/quote]

Code:
$route['incoming/route(.*)'] = 'controller/method$1';

Very simple.
#58

[eluser]M4rc0[/eluser]
Can anybody provide me a file structure example of Modular Separation in use ?

When should you use "modules" ?
I know that if you want to have an admin interface this might be useful, but what else?

Sorry to ask this, it's just didn't find any documentation about it.

Thanks in advance!

EDIT: Hmmm, just saw your signature about Modular Extensions. That helped understanding!
So by using those attached files I can have modular separation without the need of a lib/plugin for it?
#59

[eluser]dinhtrung[/eluser]
Hi, I'm building a modular administration portal for my company. I really like the way Wordpress construct their Library for Image, Videos, Documents and Musics.
Is there anyway to build a "shared" modules, which will provide utilities for other modules in the system? Anyone done this task before? I want to learn how did you do it. Please, I'm in short of time for my project...
If the module can provide another tab inside the form of other module, then that would be great. For example, something like "Comment Configuration", with 2 options : "Enable Comments" or "Disable Comments". Then this module could be use for "Articles", "Pages" and "Categories" modules : the same view, the same field.
Any suggestion???
#60

[eluser]dinhtrung[/eluser]
Quote:...How do I find out the current module I’m executing from?
More over, you can find out the current module, controllers, methods, and uniqueid of the object you're interact with this:
Code:
$this->module = $this->router->fetch_module();
            $this->controller            = strtolower(get_class($this));
            $s                             = $this->uri->rsegment_array();
         $n                             = array_search($this->controller, $s);
         $this->method                 = $this->uri->rsegment($n+1);
         $this->uniqueid            = $this->uri->rsegment($n + 2);
         log_message('info', "User accessing module : ".$this->module. " controller ".$this->controller." method ".$this->method);
From PyroCMS! Thank Phil for his code!




Theme © iAndrew 2016 - Forum software by © MyBB