Topic on Extension talk:DataTable2

Jump to navigation Jump to search

Using DataTAble2 in Templates

Cruickshanks (talkcontribs)

Hello again RV1971,

I am continuing to enjoy your extension and finding it a very powerful tool.

I am now trying to use it to gather up citations used throughout my wiki. I have tried various combinations of the following code added to the {{cite news |title= |url= |newspaper= |location= |publisher= |page= |date= |accessdate= }} template.

<datatable2 table="cite news" columns = "url|title|newspaper|location|date|accessdate|page|publisher" fs=";">

However, rather than insert the parameters into the datatable2-data table for each call to the {{Cite news}} template, it only injects {{{url}}}, etc. as text in the fields. This occurs when I save the actual {{Cite news}} template in the Template namespace, and nothing is generated by saving articles.

(As I could not get it to work, I do not know whether the table="cite news" parameter would simply overwrite the same row on each instance the template was called, sometimes multiple times in one article, and I would have to use one of the template parameters to create a unique logical table name.)

I realise that the DataTable2 extension uses the NewRevisionFromEditComplete hook to save data to the database, but with my low/fundamental knowledge was hoping that via substitution/transclusion this technique might be made to work when articles were saved with calls to the {{Cite news}} template.

Would you please provide me with guidance as to whether the proposed use of the DataTable2 extension might work with some further perserverence, or the concept is fundamentally flawed due to, for instance, the NewRevisionFromEditComplete hook. If the concept is flawed, I will drop my pursuit of this idea.

Thanks in advance.

RV1971 (talkcontribs)

Dear Cruickshanks,

you're correct that the key point is the use of NewRevisionFromEditComplete. Indeed, it is the page text as saved in the database which is parsed for <datatable2> tags, without any kind of parameter expansion. It can't be otherwise because when saving the page, nothing is known about any transclusion within other pages.

So I'm afraid your idea needs to be dropped.

Cruickshanks (talkcontribs)

Thanks for you quick response RV1971. Idea is dropped. :)

Reply to "Using DataTAble2 in Templates"