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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.