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

  • Home
  • SEARCH
  • 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 3664184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:37:03+00:00 2026-05-19T01:37:03+00:00

For a project I used some logic in my view, this is not the

  • 0

For a project I used some logic in my view, this is not the way to go so I want to get it out.

The problem is that it can’t be done from a class method of my model because Zend will make 10000 of queries from 10000 of instances to the database and it becomes very slow.

So I have to do it on a way that it loads all data at once, then processes it and returns the data back to the view. In my view it works the way I do it, the only problem is that it is IN the viewfiles.

What is the way to go? Just make a class in the model that inputs the values and returns required data?

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-19T01:37:03+00:00Added an answer on May 19, 2026 at 1:37 am

    Here is the way i would go to display data from a MVC perspective

    Controller

    function someAction(){
        $someTable = new Model_DbTable_SomeTable();
        $allData = $someTable->fetchAll();
    
        $arrayFormattedData = DataProcessor::process($allData);
    
        $this->view->data = $arrayFormattedData;
    }
    

    You have to do your logic processing in a model (in the example above its done in the static class DataProcessor throught the process method (Not neccessarly the way to go, but it could be a good start)

    View

    echo $this->dataParser($this->data); // using a view helper to parse data to be displayed
    

    or

    echo $this->partialLoop('partialLoop.phtml', $this->data); // using the partial loop view helper built in in ZF
    

    Finally, you should try to make your models as flexible as possible to make them reusable which is the key in oop development.

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

Sidebar

Related Questions

I have a problem regarding the ksoap2. My problem is that the project used
I have a VS project used for my .NET WCF host with some simple
I'm currently refactoring/tidying up some old C code used in a C++ project, and
In a Django project, some cronjob programs are mainly used for administrative or analysis
In my project i used this below function public function createIconMenu():NativeMenu{ var iconMenu:NativeMenu =
I'm adding some code to my project that allows drag and drop. The Form
I have a project that contains several submodules, that communicate using some objects that
From my understanding, helpers are mainly used to clean up views from some view-specific
I just got off a small project using a WCF/REST Web Service that used
During my apprenticeship, I have used NHibernate for some smaller projects which I mostly

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.