Uploaded image for project: 'Shindig'
  1. Shindig
  2. SHINDIG-1397

TemplateParser does not put childnodes of template call into current DataContext

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0-RC2
    • Component/s: PHP
    • Labels:
      None

      Description

      If you have this template

      <script type="text/os-template" xmlns:myapp="http://example.com/myapp" tag="myapp:HelloWorld">
      <div style="color: ${My.MessageStyle.color}">Your message is: ${My.message}</div>
      </script>

      And call it like this:
      <myapp:HelloWorld message="Hello World">
      <MessageStyle color="blue"/>
      </myapp:HelloWorld>

      The resulting HTML should be:
      <div style="color: blue">Your messageis: Hello World</div>

      But the current PHP Shindig does not put the childnodes into the current DataContext.

      Here is the patch for this:

      — - 2010-07-26 17:30:23.000000000 +0200
      +++ php/src/gadgets/templates/TemplateParser.php 2010-07-26 17:28:50.000000000 +0200
      @@ -138,6 +138,7 @@
      if (isset($childNode->tagName) && ! empty($childNode->tagName))

      { $nodeParam = ($pos = strpos($childNode->tagName, ':')) ? trim(substr($childNode->tagName, $pos + 1)) : trim($childNode->tagName); $this->dataContext['_os_render_nodes'][$nodeParam] = $childNode; + $myContext[$nodeParam] = $this->nodeAttributesToScope($childNode); }

      }
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bhofmann Bastian Hofmann
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: