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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:56:19+00:00 2026-05-20T09:56:19+00:00

I’m new to Zend framework and trying to get some insights about code re-usability.

  • 0

I’m new to Zend framework and trying to get some insights about code re-usability. I definitely know about modules but there seems to be a bit of uncertainty about what functionality should go into modules and what not.

What I’m trying to accomplish:

1) to have reusable mini programs/widgets/plugins (whatever you may call them) that one can simply plug into any site be doing this in layout or view:

<?php echo $this->contactform;?>

or this in the view:

<?php echo $this->layout()->blog;?>

I’d call them extension. so basically sort of what you’d see in Joomla/ WordPress/Concrete5 templates.

2) All code that is related to that specific extension should be in it’s separate directory.

3) We should be able to output extensions only for certain modules/controllers where they are required. they shouldn’t be rendered needlessly if it won’t be displayed.

4) each extension may output multiple content areas on the page.

Do you have a nicely laid out structure / approach that you use?

  • 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-20T09:56:19+00:00Added an answer on May 20, 2026 at 9:56 am

    It sounds like you need study up on view helpers. View helpers can be a simple as returning the App Version number or as complicated as adding html to multiple place holders. For example:

    layout.phtml:

    <h1><?php echo $this->placeholder('title'); ?>
    <div class="sidebar">
        <?php echo $this->placeholder('sidebar'); ?>
    </div>
    <div class="content">
        <?php echo $this->layout()->content; ?>
    </div>
    

    in your view script foo.phtml for example:

    <?php
        $this->placeholder('title')->set('Hello World!');
        $this->placeholder('sidebar')->set('Hello World!');
    ?>
    <h1>Bar Bar!</h1>
    

    Now if you want to be able to reuse that over and over again you can do this:

    <?php
    class Zend_View_Helper_MyHelper extends Zend_View_Helper_Abstract
    {
        public function myHelper()
        {
            $this->view->placeholder('title')->set('Hello World!');
            $this->view->placeholder('sidebar')->set('Hello World!');
            return '<h1>Bar Bar!</h1>';
        }
    }
    

    Now, replace the code in your foo.pthml with:

    <?php
    echo $this->myHelper();
    

    Both examples of foo.phtml output:

    Hello World!

    Hello World!

    Bar Bar!

    Of course this is very simplified example, but I hope this helps point you in the right direction. Happy Hacking!

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

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I've got a string that has curly quotes in it. I'd like to replace
I'm looking for suggestions for debugging... If you view this site in Firefox or
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

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.