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 ? 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'); 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'); ?>" .. /> 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
Archived
This topic is now archived and is closed to further replies.