Friday, June 18, 2010

Variables on templates


Hi, I was studying the Wikipedia Templates and I have see somes codes like this:
But "bodystyle" isn't defined anywhere and it isn't invoked but has a value in the page result. Exists some meaning to define this values? Thanks.

Respuesta 1:

Yes. It is set on call.

Eg. if you have tamplate foo containing:
You could call it as:
{{foo|Hello World!|style=color: blue|bodystyle=background-color: red}}
And the result will be:
Hello World!

Respuesta 2:

In this case, both "bodystyle" and "style" are parameters that are
passed to the template by whatever is instantiating it (e.g. another
template or an instance of the template living on a page somewhere). For
{{some template | bodystyle = color:black; | style = font-weight:bold; }}

Hope that makes sense.

Ryan Kaldari

No comments:

Post a Comment