Silverstripe Routing即将出现,因为找不到页面

时间:2015-02-04 16:53:21

标签: routing silverstripe

我有两条路线,我正在努力。其中一个有效,其中一个没有。 UserEducation_Controller路由正常,但UserEmployment_Controller没有。这是我的代码:

http://pastebin.com/09xmfhr4

这就是我的routes.yml文件:

---
Name: userroutes
After: framework/routes#coreroutes
---
Director:
    rules:
        'user/education' : 'UserEducation_Controller',
        'user/employment' : 'UserEmployment_Controller',
        'user' : 'User_Controller'

---
Name: jobroutes
After: framework/routes#coreroutes
---
Director:
   rules:
      'job' : 'JobPosting_Controller'

这是我的UserEducation.php文件:

class UserEducation_Controller extends Page_Controller {

    private static $allowed_actions = array(
        'add', 
        'edit' => '->isOwner', 
        'remove' => '->isOwner', 
        'UserEducationForm', 
        'doAdd'
    );

    private static $url_handlers = array('edit/$ID' => 'index', 'add' => 'index');

    // INSERT NEW EDUCATION ENTRY
    public function index()
    {
        $backUrl = $this->request->getVar('BackURL');

        // If register success
        if( $this->request->getVar('success') == 1 )
        {
            // Form submission was successful so redirect to BackURL
            return $this->redirect( $backUrl );
        }

        return $this->renderWith(array('UserEducation', 'Page'));
    }
}

这是我的UserEmployment.php文件:

class UserEmployment_Controller extends Page_Controller {

    private static $allowed_actions = array(
        'add', 
        'edit' => '->isOwner', 
        'remove' => '->isOwner', 
        'UserEmploymentForm', 
        'doAdd'
    );

    private static $url_handlers = array('edit/$ID' => 'index', 'add' => 'index');

    // INSERT NEW EMPLOYMENT ENTRY
    public function index()
    {
        Requirements::css('themes/simple/datetimepicker/jquery.datetimepicker.css');

        $backUrl = $this->request->getVar('BackURL');

        // If register success
        if( $this->request->getVar('success') == 1 )
        {
            // Form submission was successful so redirect to BackURL
            return $this->redirect( $backUrl );
        }

        return $this->renderWith(array('UserEmployment', 'Page'));
    }
}

我尝试切换路线的位置,以便先找到工作,然后不改变任何东西。结果是一样的(教育工作,就业没有)。 我在我的工作中创建了一个公共函数init()方法,并在那里做了一个die()语句,但是它甚至没有打到,所以我猜它甚至没有打到控制器。

有什么想法吗?

感谢。

0 个答案:

没有答案