Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6535093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:19:53+00:00 2026-05-25T10:19:53+00:00

hello I just want to ask whether we can call a view method to

  • 0

hello I just want to ask whether we can call a view method to a model? I know that we can call it on our controller in zend framework. Like if I want to call the url method of view on my controller I can call it like this

$this->view->url(array(),'');

and on the view we just can call it by

$this->url(array(),'');

But When I tried to call the same method on my model by

$this->view->url(array(),'');

it generates an error of call to undefined method url.
Now I want to ask whether it is possible to call view method to a model? If yes then how? What Am I doing wrong.
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:19:54+00:00Added an answer on May 25, 2026 at 10:19 am

    If you want to use the URL helper, why not inject / lazy load it in your model, eg

    class Application_Model_MyModel
    {
        /**
         * @var Zend_Controller_Action_Helper_Url
         */
        private $urlHelper;
    
        public function setUrlHelper(Zend_Controller_Action_Helper_Url $helper)
        {
            $this->urlHelper = $helper;
            return $this;
        }
    
        /**
         * Lazy load URL action helper
         *
         * @return Zend_Controller_Action_Helper_Url
         */
        protected function getUrlHelper()
        {
            if (null === $this->urlHelper) {
                $this->setUrlHelper(
                    Zend_Controller_Action_HelperBroker::getStaticHelper('url'));
            }
            return $this->urlHelper;
        }
    
        public function someMethod()
        {
            $url = $this->getUrlHelper()->url(array(), null);
        }
    

    This way, you can either pass the helper to your model from the controller…

    $model = new Application_Model_MyModel;
    $model->setUrlHelper($this->_helper->getHelper('url'));
    

    or let the lazy loader fetch it statically from the helper broker.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello friends i just want to know that whether we can access or fetch
I just want to ask that how do i add html suffix to each
Hello guys, just want you to ask something about my code... I have 5
Hello i just want to ask if i build my iphone app for release
Hello fellow developers... just to make sure, I want to ask this question: How
Just a blackout, I want the String hello hallo tjena hej tere to an
I'm just starting with Adobe Flex on linux, and can't get the hello world
i just want to ask if do i need to set something to enable
I have a data model that contains a DateTime attribute, date. I want to
i just want to know if there is a way for a loop to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.