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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:52:06+00:00 2026-05-16T14:52:06+00:00

I have a layout with 4 separate chunks. They are: A nav panel with

  • 0

I have a layout with 4 separate “chunks”. They are:

  • A nav panel with a menu and breadcrumbs. This is constructed using Zend_Navigation.
  • A sidebar, which shows general “news” by default
  • A content area, where the main output from each controller action would be placed
  • A header area, which is the above the navigation, which normally displays just some stock text and a photo.

The content area fits in with the traditional single view model that the documentation for Zend_Application states, but the other three do not. They all have reasonable default views to use, but a controller needs to be able to override them if needed. For example, it makes sense for an administration page to override the “newsy” view to display a log of recent administrative actions taken on the system.

The Zend_Layout/Zend_Application examples, however, all assume a single view (they call <?php echo $this->layout()->content; ?>.

How can one accomplish this kind of overriding of the layout? The only solution I’ve thought of would be to store overridden Zend_Views inside Zend_Registry, but that seems like holding things together with duct tape 😉

  • 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-16T14:52:07+00:00Added an answer on May 16, 2026 at 2:52 pm

    I believe what you are referring to are called “Named segments”. Zend Framework’s response object has support for these so called “named segments”, and will allows you to segregate body content into different segments.

    For example take the following layout file:

    <div id="nav">
        <?php echo $this->layout()->nav ?>
    </div>
    <div id="content">
        <?php echo $this->layout()->content ?>
    </div>
    

    Here you have 2 named segments, being “content” and “nav”. By default, output from your view scripts will be rendered to the “content” segment. In order to render output to the “nav” segment, you could do the following in a controller:

    <?php
    
    $response = $this->getResponse();
    $response->insert('nav', $view->render('nav.phtml'));
    
    ?>
    

    This feature gets particularly useful when used in conjunction with the ActionStack action helper. Take for instance that you are at an administration page, and you would like to override the “nav” section, then you could determine per controller which part you want render to that segment. The best way to explain this would be by a code example:

    <?php
    
    class PageController extends Zend_Controller_Action
    {
        public function barAction()
        {
            // this would render the output of NavController::menuAction()
            // to the "nav" segment (note how we set the response segment in the
            // NavController in order to do this)
            $this->_helper->actionStack('menu', 'nav');
        }
    }
    
    class NavController extends Zend_Controller_Action
    {
        public function menuAction()
        {
            $this->_helper->viewRenderer->setResponseSegment('nav'); 
            // do stuff
        }
    }
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many <div> tags separate from each other. They all have this layout:
I have a layout like this in which I want to display a label
I have a layout which looks like this: <LinearLayout> <ImageView> android:width=wrap_content android:height:wrap_content ... </ImageView>
So I have a layout that is a separate file, so I inflate it.
I have this layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=wrap_content android:orientation=horizontal android:gravity=left> <LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal>
I have a layout with two children one after another, like this: |<view1><text1> |
I have a layout setup which can be view here: http://jsfiddle.net/Pn3ts/ It all works
I have a repository whose layout is like this: trunk/ projectA projectB branches/ projectA-1.0
I've read these pages regarding this: http://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with-CodeIgniter Separate Admin and Front in codeigniter (look
I plan to have a completely separate layout/design for a desktop Vs tablet user.

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.