Najam-us-Saqib
Najam-us-Saqib

Reputation: 534

Get the Value of the URL in ZF

I want to get the this following value from the URL in zend.

$FrontController = Zend_Controller_Front::getInstance();
$Router = $FrontController->getRouter();
$Router->addRoute("homestore",
new Zend_Controller_Router_Route (
    "index/store",
    array("controller" => "index", "action" => "home")
);

I want to get the store from the URL instead of actual action value that is home. How could I do this. I have tried a lot of searches but can't find any thing useful.

Upvotes: 0

Views: 60

Answers (2)

ARIF MAHMUD RANA
ARIF MAHMUD RANA

Reputation: 5166

If you have htaccess enable than use this basename($this->getRequest()->getRequestUri()) source https://stackoverflow.com/a/7112581

Upvotes: 2

user771071
user771071

Reputation:

You can get the current route name by doing this:

Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName();

Or what you can do is just get the full request URI, and get the value from there:

// This is inside a Controller.
$this->getRequest()->getRequestUri();

Upvotes: 2

Related Questions