On 7/18/08, Paul Noden <[EMAIL PROTECTED]> wrote:
> Janandith,
>
>  I think I misunderstood what sling:include does slightly, it seems
>  sling:include is only designed to include different scripts for the
>  same resource, useful if you have broken your output into several
>  scripts driven by selectors..
no, that's actually only the secondary purpose of the sling:include
primarily it is used to include other resources, eg in a loop:

for (Iterator<Resource> iter = resolver.listChildren(resource);
iter.hasNext();) {
   %><sling:include resource="<%= iter.next() %>" /><%
}

or to get an alternative rendition of another resource:

<sling:include  path="/my/news/page" replaceSelectors="teaser" />

or to force a resource type e.g. if the path does not exist:

<sling:include path="/content/en" resourceType="myapp/basic" />

>  What i had imagined was that sling:include would have a resource="a/b" 
> option.
it does. but either as a "path" string, or a "resource" object.

>  Such that you could create three nodes:
>
>  with a property of resourceType  = foo
>  a/b
>  a/c
>
>  with a property of resourceType = bar
>  a/d
>
>
>  create three scripts:
>  apps\foo\foo.jsp
>  apps\foo\selector.jsp
>  apps\bar\bar.jsp
>
>
>  and in bar.jsp use <sling:include resource="a/b"
>  addSelectors="selector"/> etc...
yes. but like this:
<sling:include path="/a/b">  addSelectors="selector"/>

>  Relevance to resourcetype is that you can set forceResourceType="foo"
>  such that if you are working on a script being processed on node a/d
>  and you want it to adopt the same processing stream as a/b or a/c i.e.
>  a 'foo' resource then you can choose to force it to use this
>  alternative path.
>
>  Bertrand - how would you include different resources into your script,
>  and should I be using "resource" whenever I have used "nodes"? I
>  noticed I have managed to use both in a similar context... sorry.

regards, toby

Reply via email to