Welcome Guest, Not a member yet? Register   Sign In
Action based controller.
#1

[eluser]pokerking[/eluser]
Hi,

We have controllers/methods setup in routing. With php we want less files loaded in the execution path.

For example my admin controller have several methods. It is kind of doing master controller job. So i had to include lots of files in that controller.

/admin/person

/admin/person/add
/admin/person/delete
/admin/person/update...

I want to modify the controller routing based on first two strings...

/admin/person/add --goes to its own controller called personadd then it have only one action called do.

Everything is action based.

CI and many framework is designed for massive controller class with so many methods..

I do not think it is right design.

I need to probably change routing to make it action based. if any one modiefied CI , let me know.

Thanks.
#2

[eluser]Seppo[/eluser]
I think it would be proper to create a folder named "admin" and a controller named "person" with the methos add, delete, update... and move all your admin methods to new controllers inside the admin folder
#3

[eluser]wiredesignz[/eluser]
Or use modules like Matchbox or Modular Extensions
#4

[eluser]pokerking[/eluser]
folder option not working...it seems the good way...i have find out why it is not working
#5

[eluser]pokerking[/eluser]
i want these things to be more intelligent. It needs to understand first two strings are directory and controller. sometime first sting will be controller.

So i may have to rewrite router to understand that.
#6

[eluser]wiredesignz[/eluser]
The router already checks if the first segment is a directory
#7

[eluser]pokerking[/eluser]
it is not. I added directory and put the files inside the directory.
from
/admin/setup
to
/admin/admin/setup added new admin direcory inside controllers directory. moved the files inside.

not working
#8

[eluser]wiredesignz[/eluser]
Yes it is !!
Code:
//line 184 system/libraries/router.php
    function _validate_request($segments)
    {
        // Does the requested controller exist in the root folder?
        if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
        {
            return $segments;
        }

        // Is the controller in a sub-folder?
        if (is_dir(APPPATH.'controllers/'.$segments[0]))
        {        
            ...

Just because your code fails all the time doesn't mean other people have the same problem. Tongue
#9

[eluser]pokerking[/eluser]
i get empty page , it ignores the controller inside.
#10

[eluser]wiredesignz[/eluser]
Check your routes if any. An empty page is an error, not things being ignored!!




Theme © iAndrew 2016 - Forum software by © MyBB