I have a script that runs on two different pages, one for orders and one for quotes. These pages have an identical url followed by a dynamic string. What can I do to have this script do one thing on one page and one thing on another?
Edit: I wasn’t very clear on this looking back, the current selected answer does work well for what I asked, however it shouldn’t be used with Magento. Magento has built in methods for determining this information, and you would want to override it rather than inject script into the adminhtml code.
Look at the parameters from the URL via $_REQUEST in PHP. See here: http://php.net/manual/en/reserved.variables.request.php
EDIT:
I see from your comments that your URL is like
http://www.example.com/index.php/admin/sales_order/view/order_id/273151/.If it’s always this way without any query parameters, then you may want to parse the
$_SERVER['PATH_INFO']variable in PHP.(see here: http://php.net/manual/en/reserved.variables.server.php).
You can get an array of these path parts by doing:
Then you can get that last, differentiating, part of the path like this: