Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-529

Set a macro library programmatically for each individual page request

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.6
    • None
    • 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.

      Attachments

        1. template_macro_lib.patch
          36 kB
          Supun Kamburugamuva

        Activity

          People

            Unassigned Unassigned
            wglass William Glass-Husain
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: