Jump to content

Topic on Extension talk:DataTable2/Flow

Including table head in external template

2
161.185.208.127 (talkcontribs)

I have been playing with this extension trying to use it with the template in an external page, and then passing the template name as an argument. My problem is that I would also like to have the header included in the template. Is there a way to include the head definition within the template as well so I can externalize both the head and rows from the call. I would like to do something like:

<dt2-showtable table="Table1" template="Template:Table1 Template" class="wikitable" args="Descriptor=Population" where="State in ('Wisconsin')">


I was hoping that the external template would work similar to the inline template where you can pass a <head> tag so I could do something similar to below as my template but it doesn't seem to be working:

<head>

|-

! rowspan="2" | State || colspan="3" |{{{Descriptor}}} Counts || colspan="3" | Change in # of {{{Descriptor}}}||colspan="3" | % Change in {{{Descriptor}}}

|-

! 2017 || 2018 || 2019 || 2017 to 2018 || 2018 to 2019 || 2017 to 2019 || 2017 to 2018 || 2018 to 2019 || 2017 to 2019

</head>

|-

! {{{Business_Category}}} | {{{CY2017}}} || {{{CY2018}}} || {{{CY2019}}}

| {{{2017_to_2018_delta}}} || {{{2018_to_2019_delta}}} || {{{2017_to_2019_delta}}}

| {{{Percent_Change(2017-2018)}}} || {{{Percent_Change(2018-2019)}}} || {{{Percent_Change(2017-2019)}}}

Am I missing something, or is it not possible to define a <head> within an external template?

Thanks

RV1971 (talkcontribs)

I'm not sure if I understand what you mean. If I get it right, you'd like to include a template that contains <head>...</head>. This cannot work because the content in <dt2-showtable>...</dt2-showtable> is first parsed for things like <head>...</head>, and then any template substitution takes place. Hope this answers your question.

Reply to "Including table head in external template"