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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:45:31+00:00 2026-05-31T17:45:31+00:00

I used to make my own layout for managing loading pages inside the index

  • 0

I used to make my own layout for managing loading pages inside the index page

   <div id="content">
            <ul>
                <li><a href="<?php echo $this->url(array('module' => 'visits', 'controller' => 'visit', 'action' => 'index', 'page' => 'view'), NULL, TRUE); ?>" class="showVisists">Display all visits</a></li>
                <li><a href="<?php echo $this->url(array('module' => 'visits', 'controller' => 'visit', 'action' => 'index', 'page' => 'add'), NULL, TRUE); ?>" class="addVisit">Add new visit</a></li>
            </ul>

            <span class="result"><?php echo $this->message ?></span>
            <div id="innerpage">
             <?php include_once($this->pageToInclude . ".phtml") ?>
            </div>
        </div>

When I choose an anchor from the navigation, the parameter is received through the controller index action, which chooses the page I have to include and returns it to the index page so the page can be viewed.

public function indexAction() {
    $status = $this->getRequest()->getParam('page');
    switch ($status) {
        case 'view':
            $pageToInclude = 'get-visits';
            break;
        case 'add':
            $pageToInclude = 'add';
            break;
   default:
            $pageToInclude = 'get-visits';

    }

    $this->view->pageToInclude = $pageToInclude;
}

Now I want to use the layouts that are supported by Zend framework.

I enabled the layout and copied all the stuff in index to layout.phtml.

When I included pages inside the layout an error occurred. I know that I shouldn’t use includes or even require in Zend framework, but I don’t know how to show the view of “get all visits” when I click on the anchor “Display all visits” inside the layout page.

I want to make something like this:

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

            </div>

but how should I specify the content dynamically?

Note: I am new to Zend framework, and not yet familiar on how to work with it effectively.

  • 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-31T17:45:32+00:00Added an answer on May 31, 2026 at 5:45 pm

    Hum your question is not 100% Clear. Is it AJAX based?

    NON Ajax Based:

    Just link from the Navigation to your Controller Action, than the corresponding “.phtml” View is redered in “content area”:

    // reders: view/scripts/index/addvisit.phtml
    public function addvisitAction 
    {
    
    }
    

    Best way to build your links inside the navigation ist the “url” Helper:

    <?php
    
    $linkToAllVisits = $this->url(array(
        'controller' => 'index',
        'action'     => 'addvisits',
        'module'     => 'default'
    ));
    
    ?>
    
    <div id="navi">
        <li><a href="<?php echo $linkToAllVisits; ?>">AllVisits</a></li>
    </div>
    

    If you want to load the content with an ajaxRequest (i think you want to do this) just open the same controller action like in the sample above but disable the layout for this action:

    // reders: view/scripts/index/addvisit.phtml
    public function addvisitAction 
    {
        // disable layout and return only .phtml
        $this->_helper->layout->disableLayout();
    
    }
    

    by the way, if you want to use Actionnames with “-” you have to name the Actions like this in CamelCase:

    // add-visits with add-visits.phtml
    puhlic function addVisitsAction()
    {}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's been a while since I've used make , so bear with me... I've
Our application used to make use of a common base form that all forms
I used made a fft to make a band pass filter. After that I
I've used several modules to make EXEs for Python, but I'm not sure if
I have used SVN hotcopy to make a backup of the repository every weekday.
How do I make sure the correct encoding (UTF-8) is used by Grails?
I have used extension methods to extend html helpers to make an RSS repeater:
I'd like to make a listview that used the ListView.CHOICE_MODE_SINGLE so that the user
I want to make a script that can be used to send messages to
When I used to use IIS 6 (or so) I'd often make a virtual

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.