Velocity
  1. Velocity
  2. VELOCITY-529

Set a macro library programmatically for each individual page request

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6
    • Component/s: None
    • Labels:
      None

      Description

      I'd like to see Velocity allow developers to specify one or more macro files programmatically when a page is processed. The resulting behavior would be the same as if the user had used #parse to load the macro file at the top of the page. (assuming VELOCITY-362 was fixed and this worked).

      Velocity currently allows a developer to specify a VMGlobal library which loads a common set of macros applied for all pages. This is different because the macro file could be different for different pages.

      Probably the best way for this to work would be to use a structure similar to the event handlers which specifies a macro file name and attaches it to the context. When the page is processed, Velocity would use the resource loaders to load both the page and the macro file. (taking advantage of the resource caching mechanism for optimal performance).

      Why is this useful? There may be cases where different parts of an application require different sets of macros. In some cases, you may have many different parties developing different parts of the application. (For example in my primary app, we have large amounts of users regularly uploading Velocity pages to separate accounts). It's good practice to separate out modules from the main file. If this could be specified programmatically then template writers could upload both a macro file as well as a set of templates that use them.

      1. template_macro_lib.patch
        36 kB
        Supun Kamburugamuva

        Activity

        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551949 ] jira [ 12552310 ]
        Mark Thomas made changes -
        Workflow jira [ 12399802 ] Default workflow, editable Closed status [ 12551949 ]
        Will Glass-Husain made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Supun Kamburugamuva made changes -
        Field Original Value New Value
        Attachment template_macro_lib.patch [ 12361837 ]
        Will Glass-Husain created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Will Glass-Husain
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development