[Masterview-users] how to share header / layout across controllers

Jeff Barczewski
Wed, 03 Jan 2007 15:55:52 -0000

If you want to use the same layout across all controllers then you edit the
list.html template (or which ever master template which contains the
mv:generate="layouts/yourcontroller.rhtml") and you will edit this to
be
instead mv:generate="layouts/application.rhtml". There would only be
one of
these across all of your MasterView template files, all others would use
import.

In all your other templates you would use
mv:import="layouts/yourcontroller.rhtml"

If you had a layouts/appliction.rhtml previously on the file system then
delete or rename it so there is no confusion as to which one is being used.

You would probably want to rebuild your templates so they are all in sync
using the new layout, you do this at the command line with

rake mv:rebuild_all

or

you can do it from the MasterView admin screen (if in development mode
on localhost
and it hasn''t been disabled in your settings)

http://localhost:3000/masterview
and click on the Rebuild All link


If you wanted to use something other than applicion.rhtml then you would
also have to specify the layout in your controller with the layout command,
but since in the above we are using appliction.rhtml there is nothing else
necessary in the code.

See if all this makes sense and works for you. We should add this to a FAQ,
I''ll make a note to do this.

If you have any problems with everything I described let me know.

Blessings,

Jeff



On 1/2/07, Reza Primardiansyah <reza_prima77 at yahoo.com>
wrote:
>
> Hi, all
>
> Can anyone show me how to create shared layout across
> controller so I can use one design that I can put
> links to other controllers?
>
> Thanks in advance
>
-------------- next part --------------
An HTML attachment was scrubbed...