Felix Meschberger schrieb:
Hi Christoph,

Christoph Papke schrieb:
Hi folks,

we're having a strange problem with the "sling.include"-method in our
"esp"-templates.

At the moment we're trying to develop a flexible content model for a
newspaper company.
Here is a short extract of our repository structure:


------------------------------------------------
wall (sling:resourceType = "wall")
|
|--> brickgroup1 (sling:resourceType = "brickgroup")
|         |
|         |--> brick11 (sling:resourceType = "statichtmlbrick")
|         |--> brick12 (sling:resourceType = "contentbrick")
|         |--> brick13 (sling:resourceType = "contentbrick")
|
|--> brickgroup2 (sling:resourceType = "brickgroup")
          |
          |--> brick21 (sling:resourceType = "contentbrick")
          |--> brick22 (sling:resourceType = "contentbrick")
          |--> brick23 (sling:resourceType = "statichtmlbrick")
------------------------------------------------


And here are our main templates in the "apps"-directory (hint: we use an
OCM-framework to retrieve content from the repository):


------------------------------------------------
apps/wall/html.esp:
-------------------
...
// iterate over brick groups and include them
brickGroups = wall.getBrickGroups();
for (i = 0; i < brickGroups.size(); i++) {
   sling.include(brickGroups.get(i).getPath());
}
...

apps/brickgroup/html.esp:
-------------------------
...
// iterate over bricks and include them
bricks = brickgroup.getBricks();
for (i = 0; i < bricks.size(); i++) {
   sling.include(bricks.get(i).getPath());
}
...

apps/contentbrick/html.esp:
---------------------------
...
// include content item
sling.include(contentbrick.getContent().getPath());
...

apps/statichtmlbrick/html.esp:
------------------------------
...
<%= statichtmlbrick.getHtmlText() %>
...
------------------------------------------------

Now here is my problem. If "brick12" includes e.g. a referenced article,
which has includes to other content items, then "brick13" is never
reached in loop of the "brickgroup"-template.

Out of my belly, I would say above code should basically work unless
there is an error while handling the include of the
contentbrick.getContetn().getPath() in which case request processing may
be aborted.

You would find more information in the log file.

It's the same with "brickgroup2", because "brickgroup1" also includes
other content items.

It seems that the "sling.include"-method only follows one include path.

That would be absolutely wrong and desasterous I would say. Also, you
say the "abort" happens after handling brick12 -- but at that time
brick11 and brick12 have already been handled, which makes two and not
just a single one.

Is this a bug or a feature or do I get something completely wrong here?

I would assume that there is something wrong while trying to handle the
brick12 include ...

Regards
Felix
Hi Felix,

thanks for your answer.

For testing purposes we've implemented the same logic in groovy templates and the include mechanism seems to work fine.

Might there be a bug in the esp implementation?

Regards
Christoph

Reply via email to