Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Disc: Plug In System

Quote Reply
Disc: Plug In System
The plug in system is done, and is working well. Here's how it works:

1. At the simplest level, templates can now run functions. So you can do:

<%Plugin::function%>

and it will return the output of that function in the template. Also, if the function returns a hash ref, it will make all those variables available in the template. So you could have a:

package Plugin::MyStuff;

sub globals {
return { foo => bar, alpha => beta };
}

file and then when you call:

<%Plugin::MyStuff::globals%>

you can then use <%foo%> and <%alpha%> anywhere on the page.

2. Plugins can register "hooks". There are numerous hooks in Links SQL. Each template is a hook, the search has a hook, etc. A plugin can register a piece of code to get run before or after a hook. So for instance, the keyword logger is a hook that gets run after a search.

The cool part is you can stack hooks. So for instance, you can have your keyword logger, and an altavista search both registered to run after the regular search.

Plugins can tell the program to either continue on with the rest of the plugins, or stop now. So if you have a plugin that replaces the default search, it would tell Links SQL not to continue (as you don't want to search twice).

The next snapshot should have a demo you can see, it will make much more sense. =)

Cheers,

Alex

--
Gossamer Threads Inc.
Subject Author Views Date
Thread Disc: Plug In System Alex 5752 Sep 6, 2000, 2:42 PM
Thread Re: Disc: Plug In System
Paul 5482 Dec 16, 2000, 10:24 AM
Thread Re: Disc: Plug In System
Alex 5456 Dec 18, 2000, 12:49 PM
Thread Re: Disc: Plug In System
Paul 5453 Dec 18, 2000, 12:57 PM
Thread Re: Disc: Plug In System
Alex 5481 Dec 18, 2000, 1:17 PM
Thread Re: Disc: Plug In System
Paul 5413 Dec 18, 2000, 1:31 PM
Thread Re: Disc: Plug In System
Stealth 5411 Dec 18, 2000, 1:47 PM
Thread Re: Disc: Plug In System
Jagerman 5404 Dec 18, 2000, 1:51 PM
Post Re: Disc: Plug In System
Paul 5421 Dec 18, 2000, 4:52 PM
Thread Re: Disc: Plug In System
Paul 5389 Dec 18, 2000, 5:07 PM
Thread Re: Disc: Plug In System
Alex 5405 Dec 18, 2000, 5:54 PM
Post Re: Disc: Plug In System
Paul 5390 Dec 18, 2000, 6:02 PM
Post Re: Disc: Plug In System
Paul 5456 Dec 18, 2000, 2:24 PM
Post Re: Disc: Plug In System
robfromaaa 5366 Dec 18, 2000, 10:52 PM