Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-11594

Template filter not aware of extension context

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-dev
    • Fix Version/s: 3.1.0-a1
    • Component/s: Template Engine
    • Labels:
      None

      Description

      The template filter isn't aware of what context it is in, which can cause some significant issues with filename conflicts.

      For example:
      Extension 1 has a file named styles/prosilver/template/header.html
      Extension 2 has a file with the same name.

      Extension 2 tries to include its header.html file, either on its own page or, for example, on template event overall_header_head_append.
      (<!-- INCLUDE header.html -->)

      The styles/prosilver/template/header.html from Extension 1 will be included since its name comes first (the include calls locator->get_first_file_location() to try and load the first location the file is found at).

      This affects everything that can be included in template files--other template files, js files, php files, and css files (once that is implemented).

        Issue Links

          Activity

          Hide
          EXreaction EXreaction [X] (Inactive) added a comment -

          This behavior should be like Symfony bundles. Files in the bundle being called from have the first check, then it checks globally (no extensions). If a template file needs to be included from another bundle, the bundle identifier is used specifically, and then that bundle (extension) should be checked first, then check globally (no extensions).

          Show
          EXreaction EXreaction [X] (Inactive) added a comment - This behavior should be like Symfony bundles. Files in the bundle being called from have the first check, then it checks globally (no extensions). If a template file needs to be included from another bundle, the bundle identifier is used specifically, and then that bundle (extension) should be checked first, then check globally (no extensions).
          Hide
          nickvergessen Joas Schilling added a comment - - edited

          We currently use the "overwrite" approach, so you just need to put your files into a subfolder of template/ and you are safe.

          This is needed to allow "removing" stuff from a template, because events only allow to add stuff.

          Show
          nickvergessen Joas Schilling added a comment - - edited We currently use the "overwrite" approach, so you just need to put your files into a subfolder of template/ and you are safe. This is needed to allow "removing" stuff from a template, because events only allow to add stuff.
          Hide
          EXreaction EXreaction [X] (Inactive) added a comment -

          How can stuff be removed with that method?

          Show
          EXreaction EXreaction [X] (Inactive) added a comment - How can stuff be removed with that method?
          Hide
          nickvergessen Joas Schilling added a comment -

          just add a index_body.html which does not include forumlist_body.html and you have an index without the forumlist.

          Show
          nickvergessen Joas Schilling added a comment - just add a index_body.html which does not include forumlist_body.html and you have an index without the forumlist.
          Hide
          EXreaction EXreaction [X] (Inactive) added a comment -

          That doesn't work, the phpBB templates are included first.

          Show
          EXreaction EXreaction [X] (Inactive) added a comment - That doesn't work, the phpBB templates are included first.
          Hide
          EXreaction EXreaction [X] (Inactive) added a comment -

          This will be fixed from the Twig PR, once that is merged, please link and close this.

          Show
          EXreaction EXreaction [X] (Inactive) added a comment - This will be fixed from the Twig PR, once that is merged, please link and close this.

            People

            • Assignee:
              EXreaction EXreaction [X] (Inactive)
              Reporter:
              EXreaction EXreaction [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development