0
似乎創造了當前類是比我想象的更難:)我的動態菜單創建一個當前類
模塊/菜單/動作/ components.class.php
$this->elements = array( "My page" => "content/index", "Admin" => "content/index", ); $this->current = ""; foreach($this->elements as $name => $link) { list($module, $action) = explode("/", $link); if ($this->getContext()->getModuleName() == $module && $this->getContext()->getActionName() == $action) { $this->current = $name; } }
模塊/菜單/模板/ _main.php
if ($current == $name){ echo link_to($name, $link, array("class" => "selected")); }else { echo link_to($name, $link); }
如果你看的聯繫,他們到「內容/索引」(現在)。 最大的問題是,內容/索引重定向到auth/login,所以當前模塊和操作,即使URL顯示的內容/索引是auth/login。
感謝