i am unsing zend framework. i have a view linked to a controller, home,
so:
application>controllers>HomeController.php
application>views>scripts>home>index.phtml
in the index.phtml page i have a link to an action in the same controller:
application>views>scripts>home>add.phtml
the code for the link is:
<a href="../application/controllers/home/add">add</a>
Not only does this not work but i am sure its not the best way to do this in zend framework.
please note i am using wamp
http://localhost/sites/url/public/home/add
when using:
<?php
echo '<a href="' . $this->url(array('controller' => 'home', 'action' => 'add')) . '">Add Job</a>';
?>
I get this error message:
Message: Invalid controller specified (sites)
this is whats in my htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Use the url helper for this:
http://framework.zend.com/manual/en/zend.view.helpers.html
<a href="<?php echo $this->url(array('controller' => 'index',
'action' => 'index',
'module' => 'module1')); ?>" title="test">
UPDATE
This is how your .htaccess
should like:
SetEnv ENVIRONMENT development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$
RewriteRule ^.*$ index.php [NC,L]