0

I have the following code:

public function indexAction() { $view = $this->_getParam('view'); echo $view; } 

This does not print out whatever I enter after view/ unless I put index/ in front of of e.g. /index/view . Notice stackoverflow doesn't have 'index' in it's URL when we are looking at /questions/3123[any id will do].

How are they omitting the 'index' when I have to include it? I'm using Zend Framework.

2 Answers 2

2

See: Zend Framework Router - Usage

Sign up to request clarification or add additional context in comments.

Comments

0

If you don't want to follow the generic url structure, where /controller/action/paramId/paramValue, you need to set up routes. In your config, you could put:

resources.router.routes.question.type = "Zend_Controller_Router_Route" resources.router.routes.question.route = "question/:id" resources.router.routes.question.defaults.controller = "question" resources.router.routes.question.defaults.action = "index" 

A url of /question/123 should now map to the index action of the Question controller and the param id would have the value 123.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.