I had a question regarding creating a referencelinks table similar to the
imagelinks table. I have created a namespace for references and as i
understand the pages in the image namespace are formed using the name stored
in the imagelinks table and two images cannot have the same name. However in
case of references there can be many references of the same author but
different publications, so i cant just store the rl_from and rl_to in this
table. I need some way to identify the reference in this table also. Can
anyone give me any suggestions on what would be the best way to create this
table.
The current format of the table is
+---------+-----------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-----------------+------+-----+---------+----------------+
| rl_from | int(8) unsigned | | MUL | 0 | |
| rl_to | varchar(255) | | MUL | | |
|---------+-----------------+------+-----+---------+----------------+
Thanks
Quoting Rowan Collins <rowan.collins(a)gmail.com>om>:
On 28/11/05, Amruta Lonkar
<gtg808u(a)mail.gatech.edu> wrote:
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?.
Hm... I'm not sure - I can't see a reason why extension tags would
necessarily get parsed at all during the pre-save transform (as
opposed to when *viewing* the article), but then I don't know that
they won't.
Even so, I would suggest storing the IDs somewhere (e.g. create a
global variable called something like $wgReferenceIDs[]) rather than
just calling hooked functions multiple times - not that the other way
won't work, but it just seems like "nicer" coding to do them all in
one go. So, assuming renderReference() is getting called when you want
it to, you can just have it add to $wgReferenceIDs[] (or whatever) and
the other two functions can run exactly once and process everything
from that list.
--
Rowan Collins BSc
[IMSoP]
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l