Jump to content

URL Generation in Zend Framework


phpdeveloper82

Recommended Posts

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

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');

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.