[Templates] Plugin won't work after PROCESS?

darren chamberlain dlc@users.sourceforge.net
Thu, 23 Jan 2003 11:47:46 -0500


* Hann, Brian <Brian.Hann at umb.com> [2003-01-23 11:25]:
> I fixed it.  I tried an INCLUDE and that worked.  Then I realized I
> wasn't USEing the plugin in the template I was including via PROCESS.
> I added a USE directive and now it works fine.  Is this the best way
> to do things?  Does PROCESS just obliterate plugins if they aren't in
> the included template?

INCLUDE localizes the variables in the current stash before it runs.
What was most likely happening is that your included template used the
same variable name as you assigned to the plugin, and when you PROCESSed
the template, you were clobbering that name.  For example:

  # Template bar:
  [% foo = 66 %]
  [% foo %]

  # Main template:
  [% USE foo = MyPlugin %]
  [% foo.some_method %]
  [% PROCESS bar %]
  [% foo.some_other_method %]

After you PROCESS bar, foo is 66, not an instance of MyPlugin.  However,
if you INCLUDE bar, then the reassignment of foo to 66 only lasts for
the scope introduced by bar.

(darren)

-- 
A long memory is the most subversive idea in America.