This wiki is a XML full dump clone of "Heroes Wiki", the main wiki about the Heroes saga that has been shut down permanently since June 1, 2020. The purpose of this wiki is to keep online an exhaustive and accurate database about the franchise.

Template talk:ArchiveLinks

From Heroes Wiki
Jump to navigation Jump to search


Ok, I'm close on this... just have to figure out why there's an extra linebreak appearing when I apply the Delink template. I'll check on it tommorrow, but if someone else wants to try before then, feel free.--MiamiVolts (talk) 02:42, 6 January 2008 (EST)

  • Delink is working good now to help capture headers which are links, but Archive_1 and Archive_2 are breaking if a pre or nowiki tag is used. Archive_1 is breaking on the second section, Archive_2 is breaking for sections 4 through 13.--MiamiVolts (talk) 12:42, 6 January 2008 (EST)
    • This ArchiveLink template is working now for my archives! A few more things to improve still: the Delink only currently removes a link if it's the entire string that's given; the sections can be and should be hardcoded 1-20 so they don't have to be entered.--MiamiVolts (talk) 23:18, 6 January 2008 (EST)
  • This is really cool, and will be very helpful in archiving pages. A quick test shows a couple of issues, which I'm sure you're already aware of:

Talk:Main Page/Archive 1: MaWh

It looks like sections 1, 6, and 15 aren't showing up. Really, what the problem is is that the last six characters are cutting off. And since the section names aren't complete, the jumps aren't working. Everything else looks great to me! -- RyanGibsonStewart (talk) 23:41, 6 January 2008 (EST)

  • Right, the code is customized to crop correctly based on the length of my archive's pagename. That's why it's working for my archives but not others (and why I put that comment [at least for my archive]). I just finished implementing the hard-coding of the argument. Next up is making the cropping vary based on pagename length.--MiamiVolts (talk) 23:57, 6 January 2008 (EST)
    • See below the lengths for reference:

Length of User talk:MiamiVolts/Archive 1: 30
Length of Talk:Main Page/Archive 1: 24
--MiamiVolts (talk) 00:04, 7 January 2008 (EST)

  • Length varying implemented but looks like we need to add section 0's, or should we? Is there any way we can fix the archive so the section numbering is correct?--MiamiVolts (talk) 00:16, 7 January 2008 (EST)
    • Ok, I fixed the archive so it's numbered correctly by moving the first header to a separate line (it was on the same line as the archiveheader template call before I moved it), and now it shows up in the above listing as expected. My current opinion is the section 0's should not be included cause if the first header is section 0, that throws off all of the edit links.--MiamiVolts (talk) 00:26, 7 January 2008 (EST)


  • I put up a rename tag on this so we can discuss the desired name for this template before moving it to the main namespace, as it might get a bit of use rather quickly. This template does have potential uses beside Archives. So I'm not sure if we want to stick with "ArchiveLinks" or to use something more descriptive like "ExternalTocBullets", as the what the template does is to generate a bullet-formatted toc for a page other than the current page (yes, that's a mouthful ;)).--MiamiVolts (talk) 01:09, 7 January 2008 (EST)
    • I don't think there's any need for a rename vote or discussion. If it's a template you're going to use, I would just go ahead and move it into the template namespace. (I don't really care what templates are called, so long as they work, but "ArchiveLinks" works just fine for me.) The discussion should be about whether or not it's used on talk pages, which I absolutely think it should. -- RyanGibsonStewart (talk) 01:35, 7 January 2008 (EST)
      • Alright, if there's no other opinions I'll move this and User:MiamiVolts/Ability name origination to the main namespace after noon. Getting some shut-eye now. :)--MiamiVolts (talk) 01:44, 7 January 2008 (EST)

20 section limit

  • Where's the 20 section limit come from? Would enlarging it simply be a matter of hardcoding more into the template or is it some DPL limitation? (Admin 12:28, 13 January 2008 (EST))
    • Yes, one issue is that it is a matter of hardcoding more DPL calls into the template. Theoretically, if you (Admin) added the loops extension, it should be possible to code it such that there was no limit. However, every section has a hardcoded dpl call, so adding more sections adds more ticks (ticks are a programming term used to describe the computational load). 20 sections (= 20 dpl calls) is enough, imho. It's also my opinion that 20 sections is enough for one archive since on average 20 sections produces a long enough page. The longer the page, the more difficult it is to navigate.--MiamiVolts (talk) 12:46, 13 January 2008 (EST)
      • Perhaps we could just have it print "More" at the end if more than 20 sections exist. Also, is there a limit to how many times it can be called on a page? I tried it on my talk page and only the first three are printing headings. (Could also be bad page names or bum headings -- if so, we should document what's breaking it.)--Hardvice (talk) 04:14, 8 February 2008 (EST)
        • Yes, we can add a "More" button if a 21st header exists. That's interesting about the total # of pages. Heroes Wiki talk:Community Portal can do at least four ArchiveLinks calls but your page is stuck on the fourth call, so I think it has to do with the number of entries cause when I commented out January and February printed. I think "includemaxlength" may let you up the number. I'll try adding the "more" button and that option in a few hours or feel free if you have the time atm. Good to see you around again.--MiamiVolts (talk) 11:07, 8 February 2008 (EST)
  • I tried using both the count= and includemaxlength= options but they didn't help. So it appears that the bug is from a template limit as any additional templates added onto your talk page after the archive do not parse. It should be possible to reduce the modularization and gain some extra nodes, or Admin can up the limit on the server side. I'll try to demodularize some shortly.--MiamiVolts (talk) 21:02, 8 February 2008 (EST)
    • Just confirmed it is a template limit. The source (from view->source) has "WARNING: template omitted, pre-expand include size too large" as commented text for each template call.--MiamiVolts (talk) 21:32, 8 February 2008 (EST)
      • If you can get me the variable to set I'll take care of it. Otherwise I'll dig into it when I have some time. (Admin 22:17, 8 February 2008 (EST))
        • Thanks, I'll check for it. As an aside, the new version of the MediaWiki server code (January 2008) no longer has the "pre-expand include limit" and replaces it with a "preprocessor node count" limit, so when we upgrade we may have to set a different variable.--MiamiVolts (talk) 23:13, 8 February 2008 (EST)
          • Ok, according to Tim Starling's August 2006 post at, the limit variable should be $wgMaxArticleSize.--MiamiVolts (talk) 23:30, 8 February 2008 (EST)
            • The default is 2MB. If DPL is working in a way that it's generating more than 2MB of data (even if it's not being displayed) out of archives that are under 50k a piece, then DPL is terribly inefficient. The 2MB limit is in place to help prevent resource issues and I'm hesitant to change it as 2MB should be more than enough if the DPL extension is reasonably designed. (Admin 19:32, 9 February 2008 (EST))
              • Particularly in this case, where we're talking about archived content that's not really dynamic. Is there an easy way to substitute the results of a DPL query? The topic headings in an archived page shouldn't change, and don't really need to be calculated on the fly every time.--Hardvice (talk) 19:41, 9 February 2008 (EST)
                • DPL has a debug option to display pre encased html instead, but using that will mess up the added formatting used by this template. DPL also has an allowcachedresults parameter that can store the results so it doesn't update on every call, though I'm not sure if that would help in this case, but might be worth a try.--MiamiVolts (talk) 21:58, 9 February 2008 (EST)
                  • I just added the allowcachedresults parameter. If nothing else, it should lessen the load on the server since the articles should cache and not update on every load. The help said the standard time is at max once every 1.5 hours and only if the page is loaded at that time. Otherwise, the update should occur whenever it gets loaded after that period of time. Also, if you want to see the current results, you can add "&action=purge" to the url/command line.--MiamiVolts (talk) 00:56, 10 February 2008 (EST)

Implementation for multiple archives

I've added documentation for using this template for more than 3 archives. The current solution is to view the source 3 archives at a time using view->source and then to convert the html to wiki markup using WikiConverter. User talk:Hardvice's talk page now displays the ArchiveLinks using this method.--MiamiVolts (talk) 02:35, 10 February 2008 (EST)


  • Admin, please take a look at the Wikipedia's template limit help. It explains how the limit works, and then examine this template in particular. The template has several subtemplates to make the coding easier. The DPL is being called 20 times for each ArchiveLinks call, and there's 10 archivelinks calls on Hardvice's page, so that's 50k*20 dpl calls = 1MB * 10 template calls = 10MB. Of course, Hardvice's archives are a little less than 50k, so that's why the 3rd ArchiveLinks call works. I'll try to demodularize some to reduce the calls, but it's not entirely the fault of DPL. It's the way this template uses dpl to get the links, and it could probably be improved..--MiamiVolts (talk) 21:58, 9 February 2008 (EST)
    • The fact that it requires 20 DPL calls in order to return the 20 sections of an article is where I consider the fault to be. Now, I guess it could be argued that it's not DPL's fault and we're just using it in an unintended manner, and I'll happily grant that. :) Unless there's some other way to get DPL to do this kind of thing neatly, I suspect we'll end up not using DPL for this in the long run. As Hardvice pointed out, archives don't really change by definition so there's not a need for it to be dynamic. I think in the long run I'll just write a bot that takes care of it and we'll just be able to add pages we want auto-archived into a "Category:Auto-Archive" or something. (Admin 22:03, 9 February 2008 (EST))


  • What's the reason for all the substring stuff on Heroes_Wiki talk:Community_Portal? Does something not work right without it? (Admin 12:53, 13 January 2008 (EST))
    • Oh, the ArchiveLinks code prints all sections (which it is what it is supposed to do), but Archive2 of the Community Portal has extra sections within <pre> code, so I used the sub function to remove them. An alternative would be to add extra exclusion code to the ArchiveLinks template itself, but an external sub was the quicky and dirty method. ;) Adding some exclusion code is on my todo list after figuring out how to make Delink parse a link wherever it exists in the string (no loop extension means it can only catch one link, but there should be a way to make it catch links that don't span the entire string).--MiamiVolts (talk) 13:07, 13 January 2008 (EST)