我有两条路线,我正在努力。其中一个有效,其中一个没有。 UserEducation_Controller
路由正常,但UserEmployment_Controller
没有。这是我的代码:
这就是我的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()
语句,但是它甚至没有打到,所以我猜它甚至没有打到控制器。
有什么想法吗?
感谢。