Template talk:WgTable: Difference between revisions
imported>Caesar Schinas (→Is this template still wanted?: new section) |
imported>Chris Day |
||
(5 intermediate revisions by one other user not shown) | |||
Line 229: | Line 229: | ||
:The current CZ setup seems to preclude us from directly doing recursion like we would probably want for this "N+1" type of implementation you mention above. This does make sense for security reasons, as with this kind of recursion a user could send the server into an infinite loop...and that would make us unhappy. Looks like in this case perhaps the direct implementation is the most straightforward, albeit a little cumbersome--[[User:David Yamakuchi|David Yamakuchi]] 15:51, 15 April 2008 (CDT). | :The current CZ setup seems to preclude us from directly doing recursion like we would probably want for this "N+1" type of implementation you mention above. This does make sense for security reasons, as with this kind of recursion a user could send the server into an infinite loop...and that would make us unhappy. Looks like in this case perhaps the direct implementation is the most straightforward, albeit a little cumbersome--[[User:David Yamakuchi|David Yamakuchi]] 15:51, 15 April 2008 (CDT). | ||
== Is this template still wanted? == | == Is this template still wanted? == | ||
Line 235: | Line 237: | ||
And besides, the very concept seems pointless to me - although this produces a table which sorts articles into the right column automatically, you ''still'' have to manually tell it ''which'' articles to list at all.<br /> | And besides, the very concept seems pointless to me - although this produces a table which sorts articles into the right column automatically, you ''still'' have to manually tell it ''which'' articles to list at all.<br /> | ||
A better solution might be to add each article to a category - [[Category:NAME Workgroup (by status)|0]], for example. Then articles would be grouped on the category page by status rather than by first letter.<br /> | A better solution might be to add each article to a category - <code><nowiki>[[Category:NAME Workgroup (by status)|0]]</nowiki></code>, for example. Then articles would be grouped on the category page by status rather than by first letter.<br /> | ||
A better solution still might be to use the Semantic MediaWiki extension, though I don't know much about it. | A better solution still might be to use the Semantic MediaWiki extension, though I don't know much about it. | ||
Anyway, what I came here to ask was : This doesn't seem to have worked. It's only used on two subgroup pages. ''Can we delete it?'' (And tc0, table0, etc.)<br /> | Anyway, what I came here to ask was : This doesn't seem to have worked. It's only used on two subgroup pages. ''Can we delete it?'' (And tc0, table0, etc.)<br /> | ||
[[User:Caesar Schinas|Caesar Schinas]] 10: | [[User:Caesar Schinas|Caesar Schinas]] 10:09, 18 May 2009 (UTC) | ||
:Oh, and this template will put a considerable load on the server each time it is used. 1200 template inclusions, right? | |||
:This is the page to exploit when you want to do a DDOS attack on CZ... | |||
:[[User:Caesar Schinas|Caesar Schinas]] 10:25, 18 May 2009 (UTC) | |||
::Wow. Try loading http://en.citizendium.org/wiki/Template:WgTable?action=purge, and then try loading http://en.citizendium.org/wiki/Welcome_to_Citizendium?action=purge. Now look at the source code for each. Right at the bottom. | |||
::When one template page takes 8.555 seconds of server time, there's something seriously wrong... (The Welcome page took 0.319 seconds, BTW.) | |||
::[[User:Caesar Schinas|Caesar Schinas]] 10:32, 18 May 2009 (UTC) | |||
I'd say delete it. Especially given the it's a server time hog. [[User:Chris Day|Chris Day]] 15:41, 18 May 2009 (UTC) |
Latest revision as of 09:42, 18 May 2009
We have a template {{pl}} that lets you see the article status without having to click on the article. It pulls data from the metadata template and adds a graphic next to it like so:
These are from level 5 to 0 descending. Can you think of a way to create a table whereby the articles are automatically put into columns based on their status? I'm thinking that part of the code from the pl template might be handy:
{{#ifeq: {{Template:{{{1|}}}/Metadata|info=status}}|0 |{{#if: {{{2|}}} | [[{{{1|}}}|<font color="#006400">{{{2|}}}</font>]] [[Image:Level0.jpg|10px]] |[[{{{1|}}}|<font color="#006400">{{{1|}}}</font>]] [[Image:Level0.jpg|10px]]}}
- Let me see what I can come up with...--David Yamakuchi 01:02, 13 April 2008 (CDT)
- I'm onto something with this:
{|border=1 |{{#ifeq: {{template:Phosphorus/Metadata|info=status}}|0|{{pl|Phosphorus}}| }} |{{#ifeq: {{template:Phosphorus/Metadata|info=status}}|1|{{pl|Phosphorus}}| }} |{{#ifeq: {{template:Phosphorus/Metadata|info=status}}|2|{{pl|Phosphorus}}| }} |{{#ifeq: {{template:Phosphorus/Metadata|info=status}}|3|{{pl|Phosphorus}}| }} |{{#ifeq: {{template:Phosphorus/Metadata|info=status}}|4|{{pl|Phosphorus}}| }} |{{#ifeq: {{template:Phosphorus/Metadata|info=status}}|5|{{pl|Phosphorus}}| }} |- |{{#ifeq: {{template:Bowling/Metadata|info=status}}|0|{{pl|Bowling}}| }} |{{#ifeq: {{template:Bowling/Metadata|info=status}}|1|{{pl|Bowling}}| }} |{{#ifeq: {{template:Bowling/Metadata|info=status}}|2|{{pl|Bowling}}| }} |{{#ifeq: {{template:Bowling/Metadata|info=status}}|3|{{pl|Bowling}}| }} |{{#ifeq: {{template:Bowling/Metadata|info=status}}|4|{{pl|Bowling}}| }} |{{#ifeq: {{template:Bowling/Metadata|info=status}}|5|{{pl|Bowling}}| }} |- |{{#ifeq: {{template:Toy/Metadata|info=status}}|0|{{pl|Toy}}| }} |{{#ifeq: {{template:Toy/Metadata|info=status}}|1|{{pl|Toy}}| }} |{{#ifeq: {{template:Toy/Metadata|info=status}}|2|{{pl|Toy}}| }} |{{#ifeq: {{template:Toy/Metadata|info=status}}|3|{{pl|Toy}}| }} |{{#ifeq: {{template:Toy/Metadata|info=status}}|4|{{pl|Toy}}| }} |{{#ifeq: {{template:Toy/Metadata|info=status}}|5|{{pl|Toy}}| }} |}
It produces:
Phosphorus | |||||
Toy |
I tried to have it work substituting the article name for {{{1}}} in {{Robert W King 07:52, 13 April 2008 (CDT)
}} but it didn't work. --
I'm not sure what your doing here, exactly but if you use a switch you can do it this way:
0 | 1 | 2 | 3 | 4 |
See the associated template {{Chris Day 11:05, 14 April 2008 (CDT)
}} for the switch and {{ }} for the initial template.- What I'm trying to do is have an organized table or lists that sort based on status level, without gaps.
- What do you mean without gaps? Would you regard the table above without gaps? Chris Day 11:42, 14 April 2008 (CDT)
- The initial table I did above, with three entries, does not top-align the entries. --Robert W King 11:48, 14 April 2008 (CDT)
- I was messing around with the style so it was off for a while. Is the current version above what you were thinking? Chris Day 11:52, 14 April 2008 (CDT)
- No, because not every entry is on the first row Template:Codefrown. That's the tricky part. The eventual goal for this thing will be a part of the workgroup template. --Robert W King 12:17, 14 April 2008 (CDT)
- So you want everything on a single row (or do you mean colomn?) and sortable (by status and name) ? Chris Day 12:29, 14 April 2008 (CDT)
- Well, each will have their own column, but they should be consecutive rows per column; not dependant on position of the previous entry. Basically it should look like this:
- So you want everything on a single row (or do you mean colomn?) and sortable (by status and name) ? Chris Day 12:29, 14 April 2008 (CDT)
- No, because not every entry is on the first row Template:Codefrown. That's the tricky part. The eventual goal for this thing will be a part of the workgroup template. --Robert W King 12:17, 14 April 2008 (CDT)
- I was messing around with the style so it was off for a while. Is the current version above what you were thinking? Chris Day 11:52, 14 April 2008 (CDT)
- The initial table I did above, with three entries, does not top-align the entries. --Robert W King 11:48, 14 April 2008 (CDT)
- What do you mean without gaps? Would you regard the table above without gaps? Chris Day 11:42, 14 April 2008 (CDT)
phosphorus | wristwatch | toy | thanksgiving | ||
wind |
where each entry falls below the next automatically, as determined by the template. --Robert W King 12:36, 14 April 2008 (CDT)
OK, now I understand what you are trying to do. Nothing jumps out as a solution to this problem, unless you want to repeat every entry five times and that does not sound ideal. Chris Day 12:38, 14 April 2008 (CDT)
So we could write:
{| | valign=top| {|class="wikitable sortable" |width=100 align=center|0 |- {{tc0|Phosphorus}} {{tc0|Bowling}} {{tc0|Stone}} {{tc0|Life}} {{tc0|Biology}} {{tc0|intron}} {{tc0|enzyme}} |} | valign=top| {|valign=top class="wikitable sortable" |width=100 align=center|1 |- {{tc1|Phosphorus}} {{tc1|Bowling}} {{tc1|Stone}} {{tc1|Life}} {{tc1|Biology}} {{tc1|Evolution}} {{tc1|Orchid}} |} | valign=top| {|class="wikitable sortable" |width=100 align=center|2 |- {{tc2|Phosphorus}} {{tc2|Bowling}} {{tc2|Stone}} {{tc2|Life}} {{tc2|Biology}} {{tc2|Evolution}} {{tc2|Orchid}} |} |}
Which would show three columns as below:
The simple version of above is (i have only coded it for three different status values):
- The following: {{WgTable|Phosphorus|Bowling|Stone|Life|Biology|Evolution|Orchid|Glycolysis}} will give the three columns below:
So, if you get you n+1 bit worked out for the {{WgTable}} template this should work. Chris Day 13:35, 14 April 2008 (CDT)
- What? --Robert W King 13:37, 14 April 2008 (CDT)
David was playing around with using logic arguments (countdown arguments? I don't know the official name) to reduce the amount of repetitive code.{{{ i.e using expressions like {{ #expr: {{{n}}} -1}}|}}} where n is the number of items in the list.
So for the three colomn table above n=8 (Phosphorus|Bowling|Stone|Life|Biology|Evolution|Orchid|Glycolysis). I can code for that in {{WgTable}} but the problem comes when you have 100 links. Obviously it would be possible to code the {{WgTable}} template to be used by up to 100 names, or even more, but I'm not sure that is the ideal way we want to go. Chris Day 13:51, 14 April 2008 (CDT)
- To continue, if {{WgTable}} had up to 100 parameters it could tabulate up to 100 article names (it currently has the ability to tabulate 40 different articles by status and alphabetical order), but anything over would not get listed. Chris Day 14:11, 14 April 2008 (CDT)
- The thing is, there's still manual work involved in that process, which is what I'm trying to avoid. --Robert W King 14:01, 14 April 2008 (CDT)
Not sure what you mean by manual work. You plan to automatically generate a list of articles for each work groups page? Wouldn't that be huge, and redundant with the categories we already have? I thought your goal here was to have some kind of refined list. Would that not have to have some kind of manual component? Chris Day 14:11, 14 April 2008 (CDT)
- Maybe I'm not being clear on what I'm trying to do. I want to use one template command to organize a table/graphic of article statuses, that users can use by typing in {{blah|articlename}} for each article and have it appropriately rendered. There shouldn't be any manual sorting; it should all be dynamic if possible. --Robert W King 14:19, 14 April 2008 (CDT)
And that is exactly what you get with the {{WgTable}} template. Maybe you are missing how it works? Test with with seven random articles and see what happens. As follows {{WgTable|Random1|Random2|Random3......Random7}} Chris Day 14:21, 14 April 2008 (CDT)
- Now you try it up to 40 different articles ({{WgTable|Random1|Random2|Random3......|Random40}}). If this is not what you want then I'm not really sure what you are trying to do. Chris Day 14:45, 14 April 2008 (CDT)
Here are 40 random article from the biology all article list: Coded as: {{WgTable|Adhesion plaques|Adipose tissue|Aerobic organism|Aeropyrum pernix|Affinity chromatography|Agkistrodon piscivorus conanti|AIDS|Alanine|Alanine cycle|Alcor Life Extension Foundation|Alexander Fleming|Alipiopsitta xanthops (Yellow-faced Parrot)|Allelopathy|Allen's rule|Allopatric speciation|Allozymes|Altruism|Amanita phalloides|Amaryllis|American Cryonics Soc|Amino acid|Anabolic steroids|Anabolism|Anal scale|Anatolian Shepherd Dog|Anatomy|Human anatomy|Angiotensin|Animal|Animal consciousness|Animal fancy|Anterior pituitary|Antineoplastons|Ape|Apoptosis|APP|Ara autocthones (Saint Croix Macaw)|Arbitrary culture theory|Archaea|Arcuate nucleus}}
And rendered as: Template:WgTable
- Is there a way to configure what it looks like? --Robert W King 15:00, 14 April 2008 (CDT)
- You can probably tweak it to look however you like. Feel free to play with it. I have just been trying to get my brain around the mechanics of it rather than the look. Is this what you are trying to do? The critical thing is how many actual articles do you anticipate having in any given table. Chris Day 15:07, 14 April 2008 (CDT)
- It could be a lot. --Robert W King 15:10, 14 April 2008 (CDT)
- You can probably tweak it to look however you like. Feel free to play with it. I have just been trying to get my brain around the mechanics of it rather than the look. Is this what you are trying to do? The critical thing is how many actual articles do you anticipate having in any given table. Chris Day 15:07, 14 April 2008 (CDT)
- Well clearly it is possible to accommodate a lot. But it might be better if it can be coded for any value up to n other wise the template will start to get pretty big. Let's wait and see if David can get it to work. Chris Day 15:14, 14 April 2008 (CDT)
Hi David, I have set up the {{WgTable}} template so it can distinguish redirects too. Currently it can work with up to 100 article names. Obviously, if you can get some kind if logic in there to work with value N, that will be great.
There is one bug that is a pain, there cannot be a space between the article name and the pipe (or brackets) otherwise the status call to the metadata template does not work. For example, {{WgTable| Biology | Life }} does not work but {{WgTable| Biology| Life}} does work. You can see an experiment on the biology workgroup at CZ:Biology_Workgroup#Lower_priority and similar sections. Chris Day 11:18, 15 April 2008 (CDT)
- The current CZ setup seems to preclude us from directly doing recursion like we would probably want for this "N+1" type of implementation you mention above. This does make sense for security reasons, as with this kind of recursion a user could send the server into an infinite loop...and that would make us unhappy. Looks like in this case perhaps the direct implementation is the most straightforward, albeit a little cumbersome--David Yamakuchi 15:51, 15 April 2008 (CDT).
Is this template still wanted?
Look, I know a lot of work has gone into this template. But there are far better ways to do it, which would only use one template instead of thirteen.
And besides, the very concept seems pointless to me - although this produces a table which sorts articles into the right column automatically, you still have to manually tell it which articles to list at all.
A better solution might be to add each article to a category - [[Category:NAME Workgroup (by status)|0]]
, for example. Then articles would be grouped on the category page by status rather than by first letter.
A better solution still might be to use the Semantic MediaWiki extension, though I don't know much about it.
Anyway, what I came here to ask was : This doesn't seem to have worked. It's only used on two subgroup pages. Can we delete it? (And tc0, table0, etc.)
Caesar Schinas 10:09, 18 May 2009 (UTC)
- Oh, and this template will put a considerable load on the server each time it is used. 1200 template inclusions, right?
- This is the page to exploit when you want to do a DDOS attack on CZ...
- Caesar Schinas 10:25, 18 May 2009 (UTC)
- Wow. Try loading http://en.citizendium.org/wiki/Template:WgTable?action=purge, and then try loading http://en.citizendium.org/wiki/Welcome_to_Citizendium?action=purge. Now look at the source code for each. Right at the bottom.
- When one template page takes 8.555 seconds of server time, there's something seriously wrong... (The Welcome page took 0.319 seconds, BTW.)
- Caesar Schinas 10:32, 18 May 2009 (UTC)
I'd say delete it. Especially given the it's a server time hog. Chris Day 15:41, 18 May 2009 (UTC)