Welcome Guest, Not a member yet? Register   Sign In
Menu Library 1.3 [05 Gen 09]
#11

[eluser]Dewos[/eluser]
And it does Wink
#12

[eluser]Bob Sawyer[/eluser]
[quote author="Dewos" date="1224216655"]And it does Wink[/quote]

Actually, it doesn't right now, which indicates to me a problem that exists outside of your library... :-) Once I get it fixed I'll come back to this. Cheers!
#13

[eluser]Bob Sawyer[/eluser]
[quote author="Dewos" date="1224214010"]Redirect your main controller to Home. It's more elegant and transparent.

Code:
//.application/config/routes.php
$route['default_controller'] = "welcome";

//.application/controllers/welcome.php
class Welcome extends Controller {

        function index()
        {        
         redirect( '/home/index/', 'location');
        }
}
[/quote]

*sigh* I just figured out what you were doing. Gotcha. It works.

I'm feeling very much like an idiot right now. ;-)

Cheers,
Bob
#14

[eluser]Dewos[/eluser]
Nice Wink
You're Welcome, too.
#15

[eluser]Jon Braud[/eluser]
Code:
//.application/config/routes.php
$route['default_controller'] = "home";

Would that not be even more elegant?
#16

[eluser]Dewos[/eluser]
Points of view. I like to see the home controller name on the url bar (for pre-processing and friendly url).
#17

[eluser]Référencement Google[/eluser]
For a better flexibility of your library, I personally like the solution of Jon. You should add it as an option and still coders can also use your way.
#18

[eluser]Dewos[/eluser]
[quote author="Too Pixel" date="1224257264"]For a better flexibility of your library, I personally like the solution of Jon. You should add it as an option and still coders can also use your way.[/quote]

1 - Automatic get Routes Default Controller Name from
Routes.php

(only) your homepage a bit slower but automagic:

Code:
if ( empty($segment) )
{
    @include(APPPATH.'config/routes'.EXT);
    $segment = $route['default_controller'];
    unset($route);
}

OR

2 - Config Mode (A bit faster but config manual):

Code:
$this->ci->config->item('default_controller');

Choose your destiny and let me know what you prefer for next release Smile
#19

[eluser]Jon Braud[/eluser]
Hmm, instead of messing around with routes. Why not just bodge something like:

Code:
$this->foo = classname(get_instance());

Into the library and let the library itself work it out and highlight the corresponding item.

I'm just blindly posting here, I've not looked at the code yet. (I just like giving my tuppence!).

Ta.
#20

[eluser]Dewos[/eluser]
[quote author="Jon Braud" date="1224260715"]Hmm, instead of messing around with routes. Why not just bodge something like:

Code:
$this->foo = classname(get_instance());

Into the library and let the library itself work it out and highlight the corresponding item.

I'm just blindly posting here, I've not looked at the code yet. (I just like giving my tuppence!).

Ta.[/quote]

Mmmm... no.
Variable $this->ci->default_controller: unset and private. Any ideas for access it from library?




Theme © iAndrew 2016 - Forum software by © MyBB