////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////


== applyLayout



=== Purpose


Applies the specified layout to either the body, a given template, or an arbitrary URL, allowing the development of "portlet"-style applications and mashups


=== Examples


[source,xml]
----
<g:applyLayout name="myLayout" template="displaybook" params="[books: books]" />
----

or

[source,xml]
----
<g:applyLayout name="myLayout" url="https://www.google.com" />
----

or

[source,xml]
----
<g:applyLayout name="myLayout">
The content to apply a layout to
</g:applyLayout>
----


=== Description


Attributes

* `name` - The name of the layout
* `template` - (optional) The template to apply the layout to
* `url` - (optional) The URL to retrieve the content from and apply a layout to
* `action` - (optional) The action whose output to include and apply a layout to, used together with `controller`
* `controller` - (optional) The controller whose action output to include and apply a layout to
* `contentType` (optional) - The content type to use, default is "text/html"
* `encoding` (optional) - The encoding to use
* `params` (optional) - The params to pass onto the page object (retrievable with the xref:pageProperty.html[pageProperty] tag); for `action`/`controller` content they are also passed as request parameters to the include
* `model` (optional) - The model (as java.util.Map) to pass to the view and layout templates
* `parse` (optional) - If `true`, forces the content to be parsed for head, title and body sections instead of reusing an already captured page


