Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-1272

<cms:includeTemplate> ignores contentNode if defined for the tag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 3.5 RC1
    • 3.0 Final
    • taglibs
    • None

      I've tried to use <cms:includeTemplate contentNode="${myNode}" path="/path/to/jsp" /> to embed JSPs with <cms:out> data filled from a random content node object. After a while I figured out that the content node is never actually used by the tag if defined!

      Check info.magnolia.cms.taglibs.Include#doEndTag(...) and the local variable "content". If set, it is never actually used for anything else then aquiring the template path (if not set). So I've fixed this for my local installation by adding the following code:

      Content content = this.contentNode;
      if (content == null)

      { // SNIPPED }

      // DANIEL BLEISTEINER
      if (content != Resource.getCurrentActivePage(req) && !localContentNodeSet && content != null)

      { Resource.setLocalContentNode(req, content); localContentNodeSet = true; }

      I had strange experiences using contentNode="${actpage}" within the JSP and had to check for that case. Maybe you know better.

      Related to that I found out that <cms:out inherit="true"/> traverses the request context path up and not the local content node's path I set. Is this intended?

        Acceptance criteria

              vivi Vivian Steller
              da3x Daniel Bleisteiner
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD

                    Estimated:
                    Original Estimate - 1h
                    1h
                    Remaining:
                    Remaining Estimate - 1h
                    1h
                    Logged:
                    Time Spent - Not Specified
                    Not Specified