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 7590869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:30:46+00:00 2026-05-30T20:30:46+00:00

Is it a good practice to use database mappers in Zend View Helper? Because

  • 0

Is it a good practice to use database mappers in Zend View Helper? Because in my case this helper is making me a box of <div> that keeps changing in real time and is to be shown in all the views there are in my application. I can not possibly give that object loading it from the database in controllers and assign it to view everytime.

It would be really helpful if someone could tell good programming practices to follow when working with zend view helpers like:

  • If it is OK to assign something to the view in the View Helpers by $this->view->variable = ... ;
  • If it is OK to create and use models in View Helpers.
  • If it is OK to use methods available to Zend_View inside a View Helper like by doing $this->view->baseUrl('...');
  • 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-30T20:30:47+00:00Added an answer on May 30, 2026 at 8:30 pm

    Your second and third bullet points seem correct to me, as long as you don’t do any logical stuff in your model from your views. The link between models and views must be read-only.

    Concerning your first point, you don’t need to assign anything to the view, you view helper should return your HTML output directly to the view.

    About your first question, you could create View Helper that is specialized in this task, so you can use it as a simple proxy between your view helpers and mappers. One view helper will allow you to access to any mapper, and others view helpers can use this view helper to get a mapper.

    Let’s see what Trygve Reenskaug thinks about MVC:

    Models

    Models represent knowledge. A model could be a single object
    (rather uninteresting), or it could be some structure of objects.

    There should be a one-to-one correspondence between the model and its
    parts on the one hand, and the represented world as perceived by the
    owner of the model on the other hand.

    Views

    A view is a (visual) representation of its model. It would
    ordinarily highlight certain attributes of the model and suppress
    others. It is thus acting as a presentation filter.

    A view is attached to its model (or model part) and gets the data
    necessary for the presentation from the model by asking questions. It
    may also update the model by sending appropriate messages. All these
    questions and messages have to be in the terminology of the model, the
    view will therefore have to know the semantics of the attributes of
    the model it represents.

    Controllers

    A controller is the link between a user and the system. It provides
    the user with input by arranging for relevant views to present
    themselves in appropriate places on the screen. It provides means for
    user output by presenting the user with menus or other means of giving
    commands and data. The controller receives such user output,
    translates it into the appropriate messages and pass these messages on
    to one or more of the views.

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

Sidebar

Related Questions

I understand that it is good practice to use a using block when getting
It is good practice to use the main method to test a java/.net class?
Is it a good practice to use Assert for function parameters to enforce their
I wonder if it is a good practice to use JUnit's @Ignore. And how
In domain driven design, it appears to be a good practice to use Factories
Is it good practice to delegate data validation entirely to the database engine constraints?
Is it good practice to have a class constructor that uses default parameters, or
Is it always good practice to provide default values for integer-like fields? I use
What is considered good practice for querying entites from a database using a simple
When designing database tables for a fresh new project, is it good practice 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.