Peter Dragon wrote:
> I=92d like to extend the template plugin functionality provided in=20
> OpenInteract/Template/Plugin.pm, which is called from templates with a=20
> OI.method() type syntax.
Is it okay to create a new plugin name as opposed to putting it in=20
the OI plugin namespace? So you'd have 'OIHTML.button()' or whatnot.
> For now I am calling $R->template->handler() and passing in a pointer t=
o=20
> an object B, which is my equivalent of OI, and calling B.popup() in=20
> templates. I didn=92t want to change the provided OI plugin code in cas=
e=20
> it is updated.
Right, but then you have duplicated code everywhere...
> What is the best way of integrating my library component ?
A 'component' in OI terms is an action that returns content. It=20
typically needs information from the model (database, whatever)=20
and/or additional Perl processing to complete its task.
Since these all seem to be display-oriented tasks rather than data=20
driven ones (like creating standard dropdown lists, etc.), then it's=20
best to use your own TT plugin. An email I sent about six weeks ago=20
to the -dev list may be of help:
http://sourceforge.net/mailarchive/forum.php?thread_id=3D1869184&forum_id=
=3D3222
My first response to damien discusses how to associate a TT plugin=20
with your package and have it available in your templates.
> Also, for installation, I see oi_manage either installs a handler in an=
=20
> area (e.g. oitest/pkg/fruit-0.15/oitest/Handler/Fruit.pm) or has a=20
> special case for OI components, for example to install=20
> base_theme/OpenInteract/Theme.pm one level about the Handler directory,=
=20
> but I cannot install my own site-specific module.
>=20
> Do I need to install components by hand or is there a better way ?
Only packages in OpenInteract::Handler::* get relocated when they're=20
installed to a website. (BTW: this is going away with OI2, since you=20
won't have this base repository + website stuff.) Everything else=20
stays the same and is addressable normally -- when the website is=20
created we copy all the relevant noncore libraries from the=20
OpenInteract:: namespace into the temporary library directory=20
($WEBSITE_DIR/tmplib). We also copy all the libraries from=20
<YOURSITE>::Handler there as well. Then we've only got one directory=20
to put on the @ISA.
If you're creating a plugin then you'd want to install it to=20
OpenInteract::MyPlugin. That should get brought into your path ok.
Later,
Chris
|