Skip to Content
Author's profile photo Thomas Alexander Ritter

BSP: How to emulate frames using MVC

h2. Introduction

Last week questions about the handling of frames with MVC came up in the forum. Furthermore one of my colleagues also asked questions about frames so I decided to write this weblog. It doesn’t feature a complete example application but simply shows the basic ideas and techniques.

h2. The Task

Most internet users are used to a basic website layout. There is a menu on the top or the left and another area where all the contents will be displayed. As pragmatic programmers we do not want to repeat ourselves so we put the menu in one frame and the sites which the user requests are shown in the other frame so that the menu has to be created only once. Now, the question is how can we achieve a similar layout using MVC?

h2. Layout using html frames


If you want to build a layout like the one displayed above you need:

    • A page with a frameset and two frames
    • The pages that will be displayed in the frames

h2. Layout using Controller and passing the view-name as a parameter




Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      I would like to thank you for this weblog.
      I've tried the option as stated in the subject line and I have come accross the following problem. You've stated that you recommend the use of this layout when you have a lot of different pages and most of them allow user interaction. I however have come accross this problem. The do_handle_event for the controllers that are are submitted via are not triggered. I would you get around this?

      Author's profile photo Former Member
      Former Member

      nice to hear that you find this weblog useful. Regarding your problem: Did you copy the do_request code from the weblog? Because when you coded it on your own, maybe you forgot to add the following line
      dispatch_input( ).
      in the do_request method of your index controller. If you do not add this method call the index controller will not dispatch the events to the subcontrollers.