[Nitro] bump Re: Question about include files

George Moschovitis george.moschovitis at gmail.com
Mon Jun 5 12:07:39 EDT 2006


Hello James,

let me try to give you some help:

There are two methods to include sub-templates in Nitro:

- Static Include (the template is injected in the main template at
  compile time,  speady-less flexible):

  <?include href="sub" ?>

  Typically you want to use the .xinc extension instead of .xhtml for
  security reasons (nitro will not render a .xinc template as a main
  template, so you can be lazy and avoid security overhead per
  subtemplate)

- Dynamic include (the template is included at run time, ie as the html code
  is generated during a request processing cycle

  <render href="sub" />
  or
  <include href="sub" /> (suit yourself)

Please note the difference between:

<render href="sub" /> (include relative to the current controller mount point)
<render href="/sub" /> (include from root '/')

Now about

def sub
  ...
  "test"
end

not working, I am planning to remove the feature where returning a
string  from an action will append it to the output buffer. You will
have to use:

def sub
  print "test"
end

(this allready works, and is the prefered way instead of @out << "test")

The reasons for this removal will be explained in another email. I
will probably reanable the behaviour where nitro will automatically
redirect to the refer if the action generates no output and there is
no other redirect. Discussion in a future email.

Hope the above was helpful. If someone could improve my usage of
english and prepare a nice Rdoc version of it so that I could include
it in the source it would be nice.

regards,
George.



  <



On 6/5/06, Jonas Pfenniger <zimba.tm at gmail.com> wrote:
> On 05/06/06, James Britt <james_b at neurogami.com> wrote:
> >
> > Sorry for the repeat; I saw no reply to this, and I want to make sure
> > I'm documenting things correctly.
> >
> >
> > Thanks!
>
> Hi James, I think some corners or Nitro are not that well tested. This
> might be one of the dusty places. I've personally never used the
> <render> thing, but you can get more informations about it in
> Glue::Template.
>
> --
> Cheers,
>   zimba
>
> http://zimbatm.oree.ch
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>


-- 
http://www.gmosx.com
http://www.nitroproject.org



More information about the Nitro-general mailing list