【发布时间】:2011-02-03 12:31:54
【问题描述】:
似乎创建一个当前类比我想象的要难:)
模块/菜单/动作/components.class.php
$this->元素 = 数组( "我的页面" => "内容/索引", "管理员" => "内容/索引", ); $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")); }别的 { 回声链接到($名称,$链接); }如果您查看链接,它们会转到“内容/索引”(目前)。 最大的问题是,内容/索引重定向到 auth/login,所以当前模块和操作,即使 URL 显示内容/索引是 auth/login。
谢谢
【问题讨论】: