Hi, First of all never use $_SERVER["PHP_SELF"] unless it's sanitised :). It's actually user input in many cases (esp. with mod_rewrite enabled which is almost a certainty with the ZF) so it's not trustworthy.
In Views, there's the Url helper which will construct a valid url for a framework based application. You can read it at Zend/View/Helper/Url.php in the library. This not (that I know of) documented in the manual - which is a shame because it's quite useful but has a few oddities which you won't notice without reading the code (like setting the third param to true so it discards previous action/controller from the new url scheme). Outside that? The ZF is purely OO based - there are no global functions or constants in the global space. It's hard to see what you need without an example of how the non-ZF application integrates with a ZF application in the same request. If your application includes the ZF bootstrap file (e.g. index.php/bootstrap.php) you might be able to use the Front Controller instance to get some of what you need by defining several global functions in that file. Far as I know this would only work after the request to the ZF is dispatched (so the Request object is populated) using: $front = Zend_Controller_Front::getInstance(); $module = $front->getRequest()->getModuleName(); $controller = $front->getRequest()->getControllerName(); $action = $front->getRequest()->getActionName(); Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com ----- Original Message ---- From: pat <[EMAIL PROTECTED]> To: Zend Framework General <[email protected]> Sent: Thursday, May 31, 2007 2:36:28 AM Subject: [fw-general] link rot issues I've been having issues with link-rot in forms and other address sensitive functions. I know that standard php has some functions for this. Like: action="<?php echo $_SERVER['PHP_SELF']; ?>" Is there anything similar in Zend Framework? Maybe a global variable or function the returns the module name, controller name, action name to a regular, non-zendframework function? like this: function get_menu_items($mod) { // module name is passed in as parameter $dir = "/" . $mod; $items = array( 'Page Factory => "$dir/page", 'Make All' => "$dir/page/make-all", 'Make Some' => "$dir/page/make-filtered", 'List Pages' => "$dir/page/list-pages/"); return $items; } function get_menu_items() { $dir = "/" . get_module_name(); // module name from function $items = array( 'Page Factory' => "$dir/page", 'Make All' => "$dir/page/make-all", 'Make Some' => "$dir/page/make-filtered", 'List Pages' => "$dir/page/list-pages/"); return $items; } ____________________________________________________________________________________ Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/
