Reputation: 6207
i have a controller name UserController in application/controllers
the base folder is zend-login and there are 3 sub folder 1= application 2 = library 3=web_root problem is here!! when ever i hit http://localhost/zend_login/web_root/user/login or http://localhost/zend_login/web_root/user/register i get this error Error 404 Object not found! both the file are there in a folder
<?php
require_once 'Zend/Controller/Action.php';
class UserController extends Zend_Controller_Action{
public function indexAction(){
$this->view->assign('name', 'xainee');
$this->view->assign('title', 'Hello');
}
public function loginAction(){
$request = $this->getRequest();
$this->view->assign('action', $request->getParam());
$this->view->assign('title', 'Login Form');
$this->view->assign('username', 'User Name');
$this->view->assign('password', 'Password');
}
public function registerAction(){
$request = $this->getRequest();
$this->view->assign('action',"process");
$this->view->assign('title','Member Registration');
$this->view->assign('label_fname','First Name');
$this->view->assign('label_lname','Last Name');
$this->view->assign('label_uname','User Name');
$this->view->assign('label_pass','Password');
$this->view->assign('label_submit','Register');
$this->view->assign('description','Please enter this form completely:');
}
}
?>
action for this is here views/scripts/user/register.phtml and
views/scripts/user/login.phtml
this is register.phtml
<?php include "header.phtml"; ?>
<h1><?=$this->escape($this->title);?></h1>
<div id="description">
<?=$this->escape($this->description);?>
</div>
<form name="register" method="post" action="<?=$this->escape($this->action)?>">
<table>
<tr>
<td><?=$this->escape($this->label_fname)?></td>
<td><input type="text" name="first_name"></td>
</tr>
<tr>
<td><?=$this->escape($this->label_lname)?></td>
<td><input type="text" name="last_name"></td>
</tr>
<tr>
<td><?=$this->escape($this->label_uname)?></td>
<td><input type="text" name="user_name"></td>
</tr>
<tr>
<td><?=$this->escape($this->label_pass)?></td>
<td><input type="password" name="password"></td>
</tr>
</table>
<input type="submit" name="submit" value="<?=$this->escape($this->label_submit);?>">
</form>
<?php include "footer.phtml"; ?>
Upvotes: 1
Views: 336
Reputation: 1805
recommended .htaccess is
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Upvotes: 1