I am new to symfony.
How can I get from Symfony 1.4 the URI path ?
I have tryied like that:
sfContext::getInstance()->getRequest()->getRelativeUrlRoot()
but is not working.
getCurrentInternalUri is, like his name tell, the internal URL, to be used in internal routing functions such as link_to.
The question is about the current URI and even if the previous answer is marked as accepted, here is the method to fetch the current URI in symfony 1.4.
$context->getRequest()->getUri();
In an action :
public function executeDelete(sfWebRequest $request)
{
$uri = $request->getUri();
}
Like this:
sfContext::getInstance()->getRouting()->getCurrentInternalUri();
This one might be of use too:
sfContext::getInstance()->getRouting()->getCurrentRouteName();
http://www.symfony-project.org/gentle-introduction/1_4/en/09-Links-and-the-Routing-System#chapter_09_dealing_with_routes_in_actions
UPDATE:
Please see Damien's answer below and im3r3k's comment for what seems to be a better method as it does not rely on context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With