hi guys,...
can some one tell me whats wrong whit this...? this is a Model Menu
that I use for version 1.2.0 and it works perfect. but now I need to
upgrade to 1.2.8 or higher and this model seems to me is not
responding...

thanks

<?php
class Link
{
  var $url;

  var $name;

  var $style;

  function Link($url, $name, $style = array())
  {
    $this->url = $url;
    $this->name = $name;
    $this->style = $style;
  }

  function parse($html, $current_url)
  {
    if($html->url($this->url) == $current_url)
      $this->style['class'] = array_key_exists('class', $this-
>style) ? $this->style['class'] . ' current' : 'current';
    return '<li>' . $html->link($this->name, $this->url, $this->style,
false, false) . '</li>';
  }
}

class Menu
{
  var $id = false;

  var $links = array();

  var $selected = false;

  function Menu($id)
  {
    $this->id = $id;
  }

  function setSelected($selected)
  {
    $this->selected = $selected;
  }

  function addLink($url, $name, $style = array())
  {
    $this->links[] = new Link($url, $name, $style);
  }

  function parse($html)
  {
    $output = '';

    if(!empty($this->links))
    {
      $current_url = $this->selected ? $html->url($this->selected) :
$html->url();
      $output = '<ul id="' . $this->id . '">';
      foreach($this->links as $link)
        $output .= $link->parse($html, $current_url);
      $output .= '</ul>';
    }

    return $output;
  }
}
?>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to