Template:Infobox: Difference between revisions

From Drama Chaser
(Editing beginning of infobox to point to the next item after the title and image parts correctly)
(adding links to some sources I'm using to figure this out, and suggestion that my building notes should move to discussion eventually)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>This is our initial practice infobox template. It should take the page title as its title, it has room for an image, etc.  
<noinclude>
 
<H1>Building notes</H1>
This is our initial practice infobox template. It should take the page title as its title, it has room for an image, etc. I have been looking at this essay for advice on the "classic infobox" kinds of infobox: https://meta.miraheze.org/wiki/Infoboxes
 
And also looking at the author's own infobox examples on https://softcell.miraheze.org/wiki/Category:Infobox_templates
 
And also the site CSS for that wiki at https://softcell.miraheze.org/wiki/MediaWiki:Common.css
 
(BTW, I'm hoping to move these build notes to discussion page eventually; please do that instead of deleting this, when it's time?)


The template offers the fields infobox-title, infobox-image, name, age, hometown, sign, and blood type as example fields.   
The template offers the fields infobox-title, infobox-image, name, age, hometown, sign, and blood type as example fields.   


I think the if statement looking for a param1 is simple logic saying that if there's another parameter listed at the end it interprets that as the thing coming up next. But I'm not sure.
Infobox code itself starts with the if statement after the table class element, and defines the first parameter to fill out in the infobox, in this case age.
 
In this code, infobox-title is doing the work of a name field, so I took out an explicit name field, but we could define a separate name field. We could also add logic to make the use of the infobox-title part optional, if we want. Right now it seems to be included automatically, and I think using it will work on all of the infoboxes we want to implement.
 
At this point I have all of the parameters, Age, Hometown, Sign, Type loading.
 
Infobox-image isn't loading, however. And I am still trying to understand how the infobox-title part and PAGENAME in brackets actually work, as well as the image stuff. That having been said much of this template is working and is modifiable to create other infoboxes! Back to the template syntax mines I go!


The name field is redundant in this infobox, because infobox-title is doing that work. so I'm taking that out.
<H1>How to use this template</H1>


</noinclude>
</noinclude>
Line 11: Line 26:
<div class="infobox-title">{{{Title|{{PAGENAME}}}}}</div>{{#if:{{{image|}}}|
<div class="infobox-title">{{{Title|{{PAGENAME}}}}}</div>{{#if:{{{image|}}}|
<div class="infobox-image">[[File:{{PAGENAME:{{{image}}}}}|300px]]</div>}}
<div class="infobox-image">[[File:{{PAGENAME:{{{image}}}}}|300px]]</div>}}
<table class="infobox-table">{{#if:{{{Age|}}}|<tr>
<table class="infobox-table">{{#if:{{{age|}}}|<tr>
     <th>Age</th>
     <th>Age</th>
     <td>{{{age}}}</td>
     <td>{{{age}}}</td>

Latest revision as of 23:50, 25 April 2024


Building notes

This is our initial practice infobox template. It should take the page title as its title, it has room for an image, etc. I have been looking at this essay for advice on the "classic infobox" kinds of infobox: https://meta.miraheze.org/wiki/Infoboxes

And also looking at the author's own infobox examples on https://softcell.miraheze.org/wiki/Category:Infobox_templates

And also the site CSS for that wiki at https://softcell.miraheze.org/wiki/MediaWiki:Common.css

(BTW, I'm hoping to move these build notes to discussion page eventually; please do that instead of deleting this, when it's time?)

The template offers the fields infobox-title, infobox-image, name, age, hometown, sign, and blood type as example fields.

Infobox code itself starts with the if statement after the table class element, and defines the first parameter to fill out in the infobox, in this case age.

In this code, infobox-title is doing the work of a name field, so I took out an explicit name field, but we could define a separate name field. We could also add logic to make the use of the infobox-title part optional, if we want. Right now it seems to be included automatically, and I think using it will work on all of the infoboxes we want to implement.

At this point I have all of the parameters, Age, Hometown, Sign, Type loading.

Infobox-image isn't loading, however. And I am still trying to understand how the infobox-title part and PAGENAME in brackets actually work, as well as the image stuff. That having been said much of this template is working and is modifiable to create other infoboxes! Back to the template syntax mines I go!

How to use this template


Infobox