Quantcast

does grails gsp have the ability to insert content other than head and body elements ? ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

does grails gsp have the ability to insert content other than head and body elements ? ?

Vineel
In lot of gsp examples I have seen layouts use "<g:layoutHead>" and <g:layoutBody>" is it possible to pick different parts of the content in my layout?

here is what I would like to do.. is this possible?

define a layout.. grails-app/views/layouts/page-layout-1.gsp

<html lang="en" class="no-js">
        <head>       
        </head>
        <body>
                <div class="page">
                        <div class="pheader"> <g:layout element="pheader"/> </div>
                        <div class="pmenu"> <g:layout element="pmenu" /> </div>
                        <div class="body-content"> <g:layout element="body-content" /> </div>
                        <div class="pfooter"> <g:layout element="pfooter" /> </div>
                </div>
        </body>
</html>

and the view as follows
<html>
<head>
<meta name='layout' content='page-layout-1' />
</head>
<html>
  <pheader> the content should go into  pheader div </pheader>
  <pmenu> the content should go into  pmenu div </pmenu>
  <body-content> this should go into body-content div </body-content>
</html>

wondering if there are any approaches in gsp that would enable us to do this?
 
Thanks
-Vineel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: does grails gsp have the ability to insert content other than head and body elements ? ?

burtbeckwith
See http://mrhaki.blogspot.com/2011/04/grails-goodness-applying-layouts-in.html

Burt

Vineel wrote
In lot of gsp examples I have seen layouts use "<g:layoutHead>" and <g:layoutBody>" is it possible to pick different parts of the content in my layout?

here is what I would like to do.. is this possible?

define a layout.. grails-app/views/layouts/page-layout-1.gsp

<html lang="en" class="no-js">
        <head>       
        </head>
        <body>
                <div class="page">
                        <div class="pheader"> <g:layout element="pheader"/> </div>
                        <div class="pmenu"> <g:layout element="pmenu" /> </div>
                        <div class="body-content"> <g:layout element="body-content" /> </div>
                        <div class="pfooter"> <g:layout element="pfooter" /> </div>
                </div>
        </body>
</html>

and the view as follows
<html>
<head>
<meta name='layout' content='page-layout-1' />
</head>
<html>
  <pheader> the content should go into  pheader div </pheader>
  <pmenu> the content should go into  pmenu div </pmenu>
  <body-content> this should go into body-content div </body-content>
</html>

wondering if there are any approaches in gsp that would enable us to do this?
 
Thanks
-Vineel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: does grails gsp have the ability to insert content other than head and body elements ? ?

Vineel

This is exactly what I was looking for.  Thanks Burt!!
Loading...