That makes sense. What is happening though is that an article can have any number of references in it and every reference has a unique id associated with it. So my purpsoe in using wgHooks is to save this reference id for every reference in the article in the database and this id can be obtained only once the user parses the string between the <ref>..</ref> tags i.e in the renderReference function in the extension file. In that case do you think this will work?.
Thanks
Quoting Rowan Collins rowan.collins@gmail.com:
On 27/11/05, Amruta Lonkar gtg808u@mail.gatech.edu wrote:
# This method will be called before an article is saved $wgHooks['ArticleSaveComplete'][] = 'myFunction';
# This method will be called before an article is displayed or previewed. $wgHooks['ParserAfterStrip'][] = 'myOtherFunction';
But where in my extension do i put this code? Will it come outside of the 2 functions in the extension file or should it be inside the renderExample function?
The idea according to docs/hooks.txt is that they be added in a "setup function" for the extension - i.e. the same one referenced in $wgExtensionFunctions[] which calls $wgParser->setHook() to setup the <ref>...</ref> bit.
As far as I can see, though, it ought to be just as possible to do this in "global" scope, outside of any class or function but inside the same file as the extension so it can be activated and deactivated with a single include() line.
I certainly *wouldn't* recommend putting it in the function that actually gets called to parse a <ref> tag, as that will lead to odd things like it hasn't been called [yet], or has been called more than once (in which case your other functions would be called more than once) and so forth.
-- Rowan Collins BSc [IMSoP] _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
-- Amruta