Template talk:DefinitionLink

From modwiki

Jump to: navigation, search

Well, here's my attempt at making a template that automatically generates a link for a definitions article and includes the coorisponding game specific icon if it's applicable.

The template is called like this...

{{DefinitionLink|
|name=shakeData
|type=Sound shader keyword
|icon=Etqw
|}}

Where you define the name, type, and "optional" icon.

As you can see below, I haven't yet worked out what to do if it a definition isn't specific to any one game...

Perhaps I can just upload a transparent spacer gif file that's named accordingly. Something like "Nonesquare_25.png" That way, if you passed the template parameters like this...

{{DefinitionLink|
|name=shakeData
|type=Sound shader keyword
|icon=None
|}}

You'd get a result like this...

But then you'd still have that hyphen at the end.

Hmmmph. I'm very dissapointed with the way templates work.

--Rich 10:52, 8 December 2005 (W. Europe Standard Time)

Contents

Did you read?

Did you read this page: http://meta.wikimedia.org/wiki/Help:Template_names%2C_variable_names_and_parameters_depending_on_a_variable_or_parameter ? It seems a little disorganized and I don't really have time to read it right now but it might help. --iceheart 15:46, 8 December 2005 (W. Europe Standard Time)

Or...

Just thinking further, you could instead of including the icon directly, include a template of the icon with " - icon" and for emptiness, just an empty template. --iceheart 15:47, 8 December 2005 (W. Europe Standard Time)

Yeah, I've read that article...

But I can't make sense of it. I tried a couple of the things mentioned in that article but they don't seem to work.

I'll have to tinker with it some more later.

--Rich 19:30, 8 December 2005 (W. Europe Standard Time)

Update

Okay, I've read that portion of the article several times now and I've come to the conclusion that it isn't the solution to what I'm after.

All they're doing is using two templates where one template calls the other. The trick is that the result of one template becomes the parameter for another.

Infact, I'm just making the creation of these pages more difficult by going all out on the templates.

I think I'll do something like you suggested and just make a simple icon template that you can call like this...

{{SpecificIcon|Q4}}

Then you could just append the above example to the end of each link that requires a specific icon.

--Rich 10:28, 9 December 2005 (W. Europe Standard Time)

Let's also talk about Subst...

I also read about substitution...

http://meta.wikimedia.org/wiki/Help:Template#Subst

What this keyword does is call a template like normal but it saves the resulting wikitext into the page instead of the call to the template.

In fact, to help explain this I'll show you.

Here's a call to the Q4page template...

Image:Q4square_bg.png The information on this page is specific to Quake 4.

And here is substitution...

Image:Q4square_bg.png The information on this page is specific to Quake 4.

I accomplished that by typing...

{{subst:Q4page}}

If you look at the source, you'll clearly see the difference. The benefit to this is that casual users don't have to learn how templates work to make simple edits. They'll never see the template call. All they'll see and edit is the resulting wikitext (Which IMHO, is a hell of alot simpler).

Anyway, chime in to let me know when you've read this and it's safe to delete this template.

Rich 10:43, 9 December 2005 (W. Europe Standard Time)

Problem

The problem with subst is of course that if the template changes, the subst-ed code doesn't change. --iceheart 14:06, 9 December 2005 (W. Europe Standard Time)

Personal tools
Main
id Tech 5