Я создал файл и даже добавил код в файл items_controller (который я узнал, поскольку не нужно было делать это в обычном PHP), но все равно получаю сообщение о том, что новая страница не найдена.
http://neighborrow.com/items/create/
Ошибка должна быть в файле items_controller
, потому что он работает в режиме отладки, но когда я перечисляю элемент, он показывает подтверждающее сообщение, которое я скопировал со страницы элементов / добавления, даже если я редактировал его длясоздать:
function create()
{
if(!empty($this->data))
{
if (!empty($this->data))
{
$user_error = false;
$this->Item->create();
if($this->Auth->user())
{
$user_id = $this->Auth->User('id');
}
else
{
if (!$user_id = $this->Item->User->is_user($this->data['Item']['user_email']))
{
$email = $this->data['Item']['user_email'];
// Create Password
$raw_password = $this->PasswordHelper->generatePassword();
// Has Password
$hashed_password = $this->Auth->password($raw_password);
// Add User
if (!$user_id = $this->Item->User->add_basic($email, $hashed_password))
$user_error = true;
// Login the User
$this->Auth->login(array('email' => $email, 'password' => $hashed_password));
// Send Registration Email
$this->Email->send_registration_email($email, $raw_password);
}
}
if(!$user_error)
{
$this->data['Item']['user_id'] = $user_id;
$this->data['Item']['approved'] = 1;
if ($this->Item->save($this->data))
{
$this->Session->setFlash('Congratulations on your first listing! After we review it to make sure it is rentable, we will send you your free profile where you can list, promote, and rent up to nine more items. Feel free to share you new listing right away! <a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>.');
$this->redirect(array('controller' => 'items', 'action' => 'view', $this->Item->id));
}
}
}
}
}