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

[eluser]Jon Braud[/eluser]
The problem I see is you're using:

Code:
$segment = $this->ci->uri->segment(1);

to get the current controllers name, thus relying on on the controllers name being in the URL.

I see how that affected the previous posted, but using:

Code:
$current = classname($this->ci);

you would achieve the same result without having people force the name of the controller into the URL which isn't always present on the homepage.

Why are you trying to access the default controller?
#22

[eluser]Référencement Google[/eluser]
Personally I would prefer to opt for performance and $this->ci->config->item('default_controller');
But you can't get this config item like that. Maybe try something like:
Code:
$RTR =& load_class('Router');
$default_controller = $RTR->default_controller;

Code never tested, that's just an idea that will probably work
#23

[eluser]Dewos[/eluser]
[quote author="Jon Braud" date="1224262010"]The problem I see is you're using:

Code:
$segment = $this->ci->uri->segment(1);

to get the current controllers name, thus relying on on the controllers name being in the URL.

I see how that affected the previous posted, but using:

Code:
$current = classname($this->ci);

you would achieve the same result without having people force the name of the controller into the URL which isn't always present on the homepage.

Why are you trying to access the default controller?[/quote]
Hey, you're right Smile
I’m feeling very much like an idiot right now. (cit) Big Grin
#24

[eluser]Jon Braud[/eluser]
[quote author="Too Pixel" date="1224262375"]Personally I would prefer to opt for performance and $this->ci->config->item('default_controller');
But you can't get this config item like that. Maybe try something like:
Code:
$RTR =& load_class('Router');
$default_controller = $RTR->default_controller;

Code never tested, that's just an idea that will probably work[/quote]

No need to go that far, essentially all this library does is wrap 1 CSS class and a few lines of PHP.

He just needs to grab the current controllers name and add the CSS class to the element from there, no need to mess around with config items.
#25

[eluser]Dewos[/eluser]
ver 1.2 cooming Smile
#26

[eluser]Dewos[/eluser]
Ver 1.2 Online Smile
Tnx Jon and all frexibility guys.
#27

[eluser]Référencement Google[/eluser]
Nice and efficient, thanks for a great and useful contribution!
I would just advice (but that may be personal) that the default tag for lists is a <ul> and not a <ol> as it's a more common practice to use <ul> lists menus.
#28

[eluser]Dewos[/eluser]
[quote author="Too Pixel" date="1224264814"]Nice and efficient, thanks for a great and useful contribution!
I would just advice (but that may be personal) that the default tag for lists is a <ul> and not a <ol> as it's a more common practice to use <ul> lists menus.[/quote]

Oky, re-download it.
Bye
#29

[eluser]Bob Sawyer[/eluser]
I'm getting this error (FWIW, I'm using Direct Submit method):

A PHP Error was encountered
Severity: Warning

Message: strripos() expects parameter 1 to be string, array given

Filename: libraries/Menu.php

Line Number: 147
#30

[eluser]Dewos[/eluser]
Ops.... Bugfix release.
Hope it's final Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB