phpdeveloper82 Posted February 22, 2010 Share Posted February 22, 2010 hello, I have started studying Zend Framework and have a doubt in creating urls. Suppose I am visiting a page: http://localhost/zend/bugs/page/1 (Using Pagination) then the edit will be like this: localhost/edit/1 So I wish to store the site url (http://localhost/zend/ ).. Any method is available in Zend for manage this ? Quote Link to comment https://forums.phpfreaks.com/topic/192912-url-generation-in-zend-framework/ Share on other sites More sharing options...
phpdeveloper82 Posted February 22, 2010 Author Share Posted February 22, 2010 It is possible to create helper class to do this.. <?php class Zend_View_Helper_GetSiteUrl { function getSiteUrl() { $site_url = 'http://localhost/zend/'; return $site_url; } } But is there any issue of using this Helper Function in the Controller & Views like : <td><a href='<?php echo $this->getSiteUrl(); ?>pages/edit/id/<?php echo $this->id; ?>'>Edit</a> Inside the controller: $bugReportForm->setAction($this->view->getSiteUrl().'pages/edit'); Quote Link to comment https://forums.phpfreaks.com/topic/192912-url-generation-in-zend-framework/#findComment-1016028 Share on other sites More sharing options...
ignace Posted February 22, 2010 Share Posted February 22, 2010 Use the BaseUrl view helper <link href="<?php print $this->baseUrl('styles/screen.css'); ?>" .. /> Quote Link to comment https://forums.phpfreaks.com/topic/192912-url-generation-in-zend-framework/#findComment-1016086 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.