This Forum has been archived

Visit the new Forums
Forums: Index WoWWiki technical New tooltip extension in php proposal

So... Cataclysm is coming. We're going to have to change all ~31,500 item tooltips anyway.

Why not take advantage of this to kill {{Tooltip}} and roll our own extension written in php? One less interpreted language to deal with and it'll still work with things like {{Item}}.

Things to keep in mind:

  • We only will have 11(ish) stats to keep track of instead of the 20+ we have now:
    • character sheet five: agility/intellect/spirit/stamina/strength
    • Bonuses still on gear: armor/block (shields only)/crit/haste/hit/mastery
  • I intend to have those attributes/bonuses explicitly listed and not defined as |attrib=+125 stam<br/>+250 int
  • Syntax on wiki-pages will be more humane than what we're having to do now.

The parser needs to do the grunt work, not secondary users like {{item}} or the javascript tooltips and especially not random users trying to add tooltips to the wiki. Chances are this is going to require changes to item/itembox/etc, but not if it can be helped. I dunno about the auto-categorization issue either.

Thoughts? I have yet to write any code; that's going to start soonish. --k_d3 01:40, December 2, 2009 (UTC)

This would probably be best done using Semantic MediaWiki, otherwise I'm pretty sure it would require some fancy template work to make it work with {{loot}} et al. --PcjWoWWiki admin (TDrop me a line!C58,926 contributions and counting) 01:43, December 2, 2009 (UTC)
If we could get it to work that way it'd be better. The question is, will crucially kill us in our sleep for enabling SMW on wikia's biggest wiki? --k_d3 01:47, December 2, 2009 (UTC)
Though if we do go the SMW route I'd probably shelve the tooltip extension option and reconfig {{Tooltip}} to handle the semantic metadata instead.
Saner on-article syntax is key whatever route we choose. --k_d3 02:49, December 2, 2009 (UTC)
One thing about that is I'm not sure you could do the multiple "equip" thing that way... --PcjWoWWiki admin (TDrop me a line!C58,926 contributions and counting) 02:52, December 2, 2009 (UTC)
It should be doable. Just need to get started working on the parser. Proof of concept code is up at User:Kaydeethree/tooltip. --k_d3 00:00, December 3, 2009 (UTC)
Looks fine. --PcjWoWWiki admin (TDrop me a line!C58,926 contributions and counting) 00:25, December 3, 2009 (UTC)
I'm not sure whether shifting some part of this implementation to PHP is a good idea -- the extension would probably not be editable by most users/admins, so the turnaround time for any updates it would require is a concern. From here, the XML tag syntax isn't much better than MW's template syntax; we could probably just as easily clean up the tooltip template to look about the same. [Performance-wise, it's worth investigating how template output can be cached.]
If we're going the full-blown PHP extension route, it might be more interesting to have things like <tooltip item="12345"/> and let the software be responsible for maintaining a cache of item stats. There is a potential issue with PTR or uncommon items, but perhaps that can be addressed in some fashion. -- foxlit (talk) 03:26, December 5, 2009 (UTC)
The more simple the on-wiki syntax the extension is able to parse the better. I'm still in the "let's get something written; ease of use be damned" phase. Feel free to tweak my code, though I should probably put it on github or gcode to be easier. Without even me trying to, my little testwiki's already caching what output I'm creating, so I expect explicitly putting mostly-formatted tooltips in the message cache and then pulling from the cache for js tooltips/etc will only help keep crap from hitting the database.
We still need to define the items on-wiki somewhere (so we can handle ptr/beta stuff), but yah, my intent for doing this is to get items directly in the database so we can reference stuff by its id/name and not have to overload {{tooltip}} yet again. Probably by (ab)using SMW if crucially doesn't kill us for suggesting it -- I'd rather not have to define "yet another wow item schema"... That is, if he'd ever get on irc when I am.
Want to display an itemlink for {{item}}? <itemlink id=foo> or <itemlink name="bar">. Want to get an icon for {{costitem}} or {{itembox}}? <icon id=foo>. And so on.
Re updates to the code -- how often do we have to change {{tooltip}}? Every few minor content patches with big changes centered around expansions? (Guess why I'm trying to do this now...) If the turnaround time is under a day or two I don't see much pain to be had. --k_d3 04:37, December 5, 2009 (UTC)
Up to v0.5. The parser for key-mode is nearly done. Still need to write code for unique[-eq], set pieces and locked. Still thinking about how to handle the native language case (think: copy/pasting a tooltip from the armory/wowhead/curse in to our edit box and having it work properly). I'll probably come up with an answer when I wake up. (Yay sleep!)
Also trying to decide how I want to put items in the database. Ideas? Please poke crucially/uberfuzzy if you see them on IRC. The techs need to be in on this too. --k_d3 08:57, December 5, 2009 (UTC)
Stroke of genius when I woke up (I love when I do that). <item>[insert copy/paste from armory]<item> or <item name=foo .../>. The latter is mostly done, will work on the former when I get off work. --k_d3 19:28, December 5, 2009 (UTC)
What about icons? --PcjWoWWiki admin (TDrop me a line!C58,926 contributions and counting) 19:41, December 5, 2009 (UTC)
Obviously I'm going to have to make a few concessions to get non-displayable info parsed: icon, quality, qbegin to name a few. I'm in the middle of writing the parser for this syntax now, see User:Kaydeethree/tooltip/body.php for what I've got so far. --k_d3 08:34, December 6, 2009 (UTC)

I take it the auto-cat is out the window now? User:Coobra/Sig4 09:02, December 6, 2009 (UTC)

Actually, far from it. Now that the script has a better handle on what these items actually are, the auto-categorization can be more complete. I'm still trying to get the parser(s) written. Then handling non-displayed information. Then trying to figure out how to hook in to the database. etc. --k_d3 09:22, December 6, 2009 (UTC)

Parsers done (more or less)

Okay... At this point, the parsers for both methods are pretty much done. They're a bunch of brute-force hacks, but hey, it's a start.

Please feel free to hack on the code. It's far from where I'd like it to be efficiency-wise, but that's still a long ways off.

Now then, time to go scare the hell out of the techs. I still have yet to handle any form of database input, but that decision needs to be made soonish. If they don't go screaming out of the room at mention of SMW, what say you? Do we just stick in [[Category:Foo]] [[Category:Bar]] in the render methods?

That's something I still need to figure out how to handle as well: the alternative use-cases. Please chime in if you have ideas--k_d3 23:49, December 6, 2009 (UTC)

I don't think we should do automatic categorization, those are more prone to change than the actual tooltip structure. --PcjWoWWiki admin (TDrop me a line!C58,926 contributions and counting) 00:00, December 7, 2009 (UTC)
If you can hook SMW through to give automatic semantic data, that would be better than categorizing. It's an issue I've long pondered though: implementation of [item] categories if WoWWiki starts using SMW. Super size to Category:Swords or some such and ignore the uber-specific categories currently used to be left to be generated as semantic data via SMW? --Sky (t · c · w) 00:37, December 7, 2009 (UTC)

Hooking in to SMW

So... I've made the plunge and hooked into SMW. Right now I'm only putting data in the tables. I've yet to get anything out of them for uses such as {{Item}}. Or, you know... using SMW. v0.10's been uploaded on User:Kaydeethree/tooltip. --k_d3 22:26, December 20, 2009 (UTC)

Oh, I should mention: If any of you want to play around on my dev wiki, contact me off-wiki or on IRC. I'm running it from my computer and I'd rather not get beaten off the net because I don't have any bandwidth. --k_d3 22:29, December 20, 2009 (UTC)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.