Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-16-2008, 09:26 AM
Junior Member
 
Join Date: Apr 2008
Posts: 7
Question Creating Multiple synamic section to display though Zend Layout

Hello,

I have been trying to create some dynamic content (A sidebar) and have it display different content dynamically.

I have working solution but it is not the way I expected it to work.

In the layout I have the following code

PHP Code:
<div class="mainContent">
    <div class="rightContent">
        <?php echo $this->action('policy','right'); ?>

    </div>
    <div class="leftContent">
        <?php echo $this->layout()->content?>
    </div>
                    
</div>
I have a RightController that deals with dynamic side of things and this actually works well. The problem is I wanted to assign the output of

PHP Code:
<?php echo $this->action('policy','right'); ?>
in the Controllers so that I can just have the following in the layout

PHP Code:
<?php echo $this->layout()->sidebar?>
Below is the code for my Init Function for a controller.

PHP Code:
function init()
{        
        
$response $this->getResponse();
        
$response->insert('footer'$this->view->render('/footer/footer.phtml')); 
        
$this->view->section 'policy';  
        

What do I need to do to get the Controller to assign a content body sidebar.

I have tried

PHP Code:
$response->insert('sidebar'$this->view->action('policy','right')); 
Which did generate the sidebar but consequently it removes the main content. Any help would be much appriciated.

Thanks

Madmaxious
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-16-2008, 02:41 PM
Elemental's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 119
Default

If you haven't already, checkout this webinar on Layout and View enhancements.

It seams to me you should be putting your dynamic menus/sidebars/etc in a placeholder then echoing that placeholder in your layout. There are a number of view helpers related to layout that can assist so make sure to check the reference manuals Layout and View sections for assistance with those as well.

Zend Framework: Documentation
Zend Framework: Documentation
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-16-2008, 03:52 PM
Junior Member
 
Join Date: Apr 2008
Posts: 7
Default The problem is that the page is dynamic

Hello,

Thanks for the post. I have a listened thorugh the whole webinar and it doesnt suggest a better way to handle it.

My pages work fine but I have a niggling thought that maybe there should be a better way to do it.

Regards

Scott
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:34 AM.