Skip to content

Instantly share code, notes, and snippets.

@xthiago
Created July 4, 2013 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xthiago/5927503 to your computer and use it in GitHub Desktop.
Save xthiago/5927503 to your computer and use it in GitHub Desktop.
Get the module, action and parameters from a url in Symfony 1.4
<?php
/* Author: http://snippets.symfony-project.org/snippet/61 (comment #12 by 'Anonymous') */
$referer = $this->request->getReferer();
if (strlen($referer) > 0)
{
$pathInfo = $request->getPathInfoArray();
$referer = str_replace(
array('http://', 'https://'),
'',
$referer
);
$referer = str_replace($pathInfo['HTTP_HOST'], '', $referer);
$referer = str_replace($pathInfo['SCRIPT_NAME'], '', $referer);
$params = $this->getContext()->getRouting()->parse($referer);
$module = $params['module'];
$action = $params['action'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment