I solved... for re-use template for al json response
case A )
in the config file output_tipe
define ouput_tipe json -> layer
<layouts default="standard">
<layout name="standard">
<layer name="content">
<ae:parameter name="directory">%core.template_dir%</ae:parameter>
<ae:parameter name="template">JsonResponse</ae:parameter>
</layer>
</layout>
</layouts>
Or Case B)
override setupHtml method
public function setupHtml(AgaviRequestDataHolder $rd, $layoutName = null){
if($layoutName === null &&
$this->getContainer()->getParameter('is_slot', false)) {
// it is a slot, so we do not load the default layout, but a
different one
// otherwise, we could end up with an infinite loop
$layoutName = self::SLOT_LAYOUT_NAME;
}
// now load the layout
// this method returns an array containing the parameters that were
declared on the layout (not on a layer!) in output_types.xml
// you could use this, for instance, to automatically set a bunch of CSS or
Javascript includes based on layout parameters -->
$this->loadLayout($layoutName);
// if output type is json set the a unique template
* $outputType = $this->container->getOutputType()->getName();*
* *
* if (strtolower($outputType) == 'json'){*
* *
* $this->getLayer('content')->setParameter('directory',
AgaviConfig::get('core.template_dir'));*
* $this->getLayer('content')->setParameter('template', 'JsonResponse');*
* }*
}
On Sun, Mar 17, 2013 at 6:30 AM, <[email protected]> wrote:
> Send users mailing list submissions to
> [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.agavi.org/mailman/listinfo/users
> or, via email, send a message with subject or body 'help' to
> [email protected]
>
> You can reach the person managing the list at
> [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of users digest..."
>
>
> Today's Topics:
>
> 1. What are the available parameters for AgaviTemplateLayer
> (Rafael Guerrero)
> 2. Re: What are the available parameters for AgaviTemplateLayer
> (Peter Limbach)
> 3. Re: What are the available parameters for AgaviTemplateLayer
> (Steffen Gransow)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 16 Mar 2013 19:50:07 -0430
> From: Rafael Guerrero <[email protected]>
> Subject: [Agavi-Users] What are the available parameters for
> AgaviTemplateLayer
> To: [email protected]
> Message-ID:
> <CAA+=Sk8SFPjt=
> [email protected]>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Guys,
>
>
> Where is the info about of valid paramteres for AgaviTemplateLayer ?
> i want to set a custom template in custom directory for reuse template from
> multiple modules
> i saw the example into the web
>
> // *re-use the input template* for presenting the errors in the form
> $this->getLayer('content')->setTemplate('Input');
>
>
> checking the class, i can see the magic metod __call
>
> and the config files ( output_type ) i can see other property
>
>
> <layer name="decorator">
> <ae:parameter name="*directory*">%core.template_dir%</ae:parameter>
> <ae:parameter name="*template*">Master</ae:parameter>
> </layer>
>
>
> i guess that i cant execute
>
> $layer->setParameter('template', *$XXXX*);
>
> or
>
> $layer->setTemplate(*$XXX*);
>
>
> why the value for template parameter is a View Name?
>
> can i set a filename ?
>
> Are there other possible values for the template parameter?
>
> what other properties exist for the AgaviTemplateLayer ?
>
>
> Thansk for your help
>
>
> --
> Atte
> Rafael ?ngel Guerrero Godoy
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.agavi.org/pipermail/users/attachments/20130316/f68a9959/attachment.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Sun, 17 Mar 2013 10:10:24 +0100
> From: Peter Limbach <[email protected]>
> Subject: Re: [Agavi-Users] What are the available parameters for
> AgaviTemplateLayer
> To: Agavi Users Mailing List <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=iso-8859-1
>
> the template parameter is not a view name it is the file name maybe this
> code snippet and the agavi faq could help you
>
> http://mivesto.de/agavi/agavi-faq.html#general_18
>
> https://gist.github.com/pelim/e401c563218b8b47c15a
>
>
> Am 17.03.2013 um 01:20 schrieb Rafael Guerrero:
>
> >
> >
> >
> > Hi Guys,
> >
> >
> > Where is the info about of valid paramteres for AgaviTemplateLayer ?
> > i want to set a custom template in custom directory for reuse template
> from multiple modules
> > i saw the example into the web
> >
> > // re-use the input template for presenting the errors in the form
> > $this->getLayer('content')->setTemplate('Input');
> >
> > checking the class, i can see the magic metod __call
> > and the config files ( output_type ) i can see other property
> >
> > <layer name="decorator">
> > <ae:parameter name="
> > directory
> > ">%core.template_dir%</ae:parameter>
> > <ae:parameter name="
> > template
> > ">Master</ae:parameter>
> > </layer>
> >
> >
> > i guess that i cant execute
> > $layer->setParameter('template', $XXXX);
> > or
> > $layer->setTemplate($XXX);
> >
> > why the value for template parameter is a View Name?
> > can i set a filename ?
> > Are there other possible values for the template parameter?
> > what other properties exist for the AgaviTemplateLayer ?
> >
> > Thansk for your help
> >
> > --
> > Atte
> > Rafael ?ngel Guerrero Godoy
> _______________________________________________
> > users mailing list
> > [email protected]
> > http://lists.agavi.org/mailman/listinfo/users
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Sun, 17 Mar 2013 10:28:52 +0100
> From: "Steffen Gransow" <[email protected]>
> Subject: Re: [Agavi-Users] What are the available parameters for
> AgaviTemplateLayer
> To: "Agavi Users Mailing List" <[email protected]>
> Message-ID: <op.wt23aeafeahkiq@graste-thinkpad>
> Content-Type: text/plain; charset="utf-8"; Format="flowed";
> DelSp="yes"
>
> Hi,
>
> Agavi uses template lookup patterns to get the correct file to render as a
> template. These lookup patterns can be set in output_types.xml or
> dynamically.
>
> Please have a look at
> http://graste.github.com/Agavi-FAQ/agavi-faq.html#general_24 for a small
> example.
>
> By default agavi looks for localized templates (e.g. en/*.php or
> *.en_UK.php). You can change the template lookup pattern defaults per
> layer via the targets parameter.
>
> This gives you a great deal of flexibility as you can do things like in
> http://graste.github.com/Agavi-FAQ/agavi-faq.html#general_25 where you can
> define a whole cascade of template lookups.
>
> Kind regards,
>
> Steffen
>
> On Sun, 17 Mar 2013 01:20:07 +0100, Rafael Guerrero <[email protected]>
> wrote:
>
> >
> >
> >
> > Hi Guys,
> >
> >
> > Where is the info about of valid paramteres for AgaviTemplateLayer ?
> > i want to set a custom template in custom directory for reuse template
> > from multiple modules
> > i saw the example into the web
> >
> > // re-use the input template for presenting the errors in the form
> > $this->getLayer('content')->setTemplate('Input');
> >
> >> checking the class, i can see the magic metod __call
> > and the config files ( output_type ) i can see other property
> >
> >> <layer name="decorator">
> > <ae:parameter name="directory">%core.template_dir%</ae:parameter>
> > <ae:parameter name="template">Master</ae:parameter>
> > </layer>
> >
> >> i guess that i cant execute
> > $layer->setParameter('template', $XXXX);or
> > $layer->setTemplate($XXX);
> >
> >> why the value for template parameter is a View Name?
> > can i set a filename ?
> > Are there other possible values for the template parameter?
> > what other properties exist for the AgaviTemplateLayer ?
> >
> >> Thansk for your help
> >>
> >> --
> > Atte
> > Rafael ?ngel Guerrero Godoy
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.agavi.org/pipermail/users/attachments/20130317/da0d50a4/attachment-0001.htm
> >
>
> ------------------------------
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users
>
>
> End of users Digest, Vol 70, Issue 2
> ************************************
>
--
Atte
Rafael Ángel Guerrero Godoy
_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users