Hi,
I'm thinking about writing an extension...and I haven't really done one totally from scratch yet, so please forgive the waste of bandwidth if I'm missing something in the documentation...and the length of this message.
Here's what I want to do and why. I'm running some wikis related to biology/genomics. We use Cite.php, and I'd like to automatically create pages for the references cited by citations in Cite. php. I've already modified Cite so that if someone enters "PMID:<id number>" as either the input text or the name= part, a block of code (essentially an extension of Cite where I've added a "hook" in Cite.php) goes to Pubmed, retrieves the detailed information about the citation and substitutes the reference text.
For example, if you have
<ref name='PMID:2167309'/>
as the third citation, the reference that shows up is
3. ↑ Rathod PK & Khatri A (1990) Synthesis and antiproliferative activity of threo-5-fluoro-L-dihydroorotate. J Biol Chem 265:14242-9 PMID:2167311
I like this because it reduces markup clutter that is a criticism of Cite. The next thing I want to do is change the external link to Pubmed to an internal link to a page in the wiki, where users can add commentary about the reference. These pages will be stubbed with more information from Pubmed, including a template, the abstract, and the reference. I'm thinking of two possible strategies:
1) Run something that creates the page (if needed) when the parser renders a page with a <ref> tag. 2) Run something that creates the page (if needed) when a user clicks on the link in the references section
These aren't mutually exclusive, of course, but what I like about #2 is that I don't create pages unless someone actually wants to look at them (upon reflection, this may create pages when the search engines hit the links, but that may be OK) and, more importantly, I think this can be done so that the page will be created if someone searches for the reference and the citation doesn't already exist.
The way I'm thinking of doing this is to hook into AlternateEdit and branch off to something that grabs the desired template from the templates namespace, populates the wikitext with data, saves it, and redirects to the saved page. Questions:
Q1) Am I nuts? (default=true) Is there anything that I'm forgetting that will make this blow up? Q2) Is that the right place to hook? Q3) What's the best way to do the create/save/redirect step? Q4) Has anyone already done something like this that I can adapt? Q5) Would this be useful to anyone else?
For Q2 and Q3, I don't want the user to see the edit form. I want it to look like the page was there all along. For #3 I have a kludgy way to do it: create the page as XML and run maintenance/importDump. There must be a better way, right? Thanks for any advice.
Jim ===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054