Git Product home page Git Product logo

cakephp-menu-helper's People

Contributors

jordanvg avatar milsom avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

cakephp-menu-helper's Issues

Improve static route

I faced a problem with multiple static routes. In my case I've this :

Router::connect('/home', array('controller' => 'pages', 'action' => 'display', 'home'));
Router::connect('/lesson', array('controller' => 'pages', 'action' => 'display', 'lesson'));

they point on home and lesson ctp file in my views folder

And my link look like this :

Menu->item($this->Html->link('Home', '/home')); ?> Menu->item($this->Html->link('Lesson', '/lesson')); ?> The problem is that your helper only test the controler and the action. If I click on home, the lesson menu is also active and vice versa.

So I've made some change in your function, maybe need some improvement.

if ($this->params['controller'] == $linkRoutes['controller'] && $this->params['action'] == $linkRoutes['action']) { if (isset($attributes['class'])) { $classes = explode(' ', $attributes['class']); $classes[] = $activeClass; $attributes['class'] = $classes; } else { if(!empty($linkRoutes['pass'][0])){ if($linkRoutes['pass'][0] == $this->params['pass'][0]){ $attributes['class'] = $activeClass; } }else{ $attributes['class'] = $activeClass; } } }

Hope this can help.

Xml class missing

Requires

App::uses('Xml', 'Utility');

in MenuHelper.php if the user isn't already using it elsewhere

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.