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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:23:16+00:00 2026-05-12T20:23:16+00:00

I’ve been working with Zend Framework (using Doctrine as the ORM) for quite a

  • 0

I’ve been working with Zend Framework (using Doctrine as the ORM) for quite a while now, and done a few projects with it.

In a few upcoming projects I am requiring the need for widgets similar to how WordPress does them. You have a post/page, which could look like:

Subscribe to my newsletter:
[subscribe/]

View my events
[events limit=5 sort=date/]

View this page's comments
[comments/]

Where say the subscribe widget would be replaced with Blog::subscribeWidget, and the events could be replaced with Events::eventsWidget, etc.

Now it has done my head in the past few weeks about how on earth do I do this??? I’ve come up with the following options:

  1. I could place the widgets within controllers, and then call them like actions. Problem here is that code could be flying between controllers, and I have read this is expensive due to the amount of dispatches.

  2. I could place the widgets as view helpers. So within the view I could have $this->renderPage($Page), which would then attend to all the widgets. Problem here is that what if the widgets need to do some business logic, like for example posting a new comment, that really shouldn’t be within the view, should it?

  3. The other option is to place widgets within the model? But then how on earth do they then render content for display?

Extra complications come when:

  1. Say the comments widget would also handle posting, deleting of comments etc.

  2. Say for the events listing, if I want to do an ajax request to the next page of events, using method #2 (view helpers) how would this work?

  • 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-12T20:23:16+00:00Added an answer on May 12, 2026 at 8:23 pm

    I left Richards reply, the problem, and further use cases cook in my brain for a while longer and ended up coming to a solution.

    I will have the following view helpers and methods:

    Content; with methods: render, renderWidgets, renderWidget, renderCommentsWidget (comments).
    Event; with methods: renderEventsWidget (many events), renderEventWidget (one event)
    Subscription; with methods: renderSubscribeWidget (subscription form).

    I will have inside my configuration file:

    app.widgets.comments.helper = content
    app.widgets.subscribe.helper = subscription
    app.widgets.events.helper = event

    I will also have the following models:

    Content for use for all pages.
    Event for use for all events.
    Subcriber for use for subscriptions to content

    So inside my view I will do something like this:
    echo $this->content()->render($this->Content)

    Content::render() will then perform any content rendering and then perform rendering of the widgets by passing along to Content::renderWidgets(). Here we will use the configuration of app.widgets to link together the widget bbcode tag to it’s appropriate view helper (using the naming convention ‘render’.ucfirst($tag).’Widget’). So for example Content::renderCommentsWidget() would then proceed to render the comments.

    Perhaps later on I will decide to have a Widget View Helper, and individual view helpers for each widget eg. ContentCommentsWidget View Helper. But for now that would just add additional unrequired complexity.

    Now to answer the AJAX problem I mentioned. Say for the comments widget allowing for comments to be posted via ajax. It would simply have an appropriate method inside the Content Controller for it. So pretty much we also have a Event and Subscription controllers too – corresponding with the view helpers. Interaction between the view helper and controller will all be hard coded, there is no purpose for it to be soft coded.

    I hope this helps someone else, and the current plan is to make the project where all this is used to be an open-source project. So maybe one day you can see it all in action.

    Thanks.


    Update:

    You can find the source code of these ideas in action in the following repositories:

    • BalCMS – this is the actual CMS which contains the widgets in /application/modules/balcms/view/helpers and contains the configuration in /application/modules/config/application/balcms.yaml
    • BalPHP – this is the resource library which contains the widget view helper at /lib/Bal/View/Helper/Widget.php
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 223k
  • Answers 223k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer git checkout <commit> <path> Commits may be specified directly by… May 13, 2026 at 12:40 am
  • Editorial Team
    Editorial Team added an answer Have you considered an additional table, filter_value_list with columns id,… May 13, 2026 at 12:40 am
  • Editorial Team
    Editorial Team added an answer var value = hashtable[key]; ? http://www.c-sharpcorner.com/UploadFile/pradeep.tiwari/PradeepTiwariHashtable11072006072247AM/PradeepTiwariHashtable.aspx May 13, 2026 at 12:40 am

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS
I want use html5's new tag to play a wav file (currently only supported

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.