Creating new content (tables) through other tables
I have not created those templates in any wiki. You could just copy the wikitext for them that I wrote in one of my previous replies.
As to table's width, you can use widetable format or set the table width for .smwtable class with site-wide CSS in MediaWiki:Common.css.
adding
.smwtable { width: 650px; }
in the Mediawiki.Common.css works like a charm
, and is no wikicode, is it?
It's plain HTML, which is also allowed in wikis. You can try to use equivalent wikicode, but there might be issues while assembling a table from several templates. You may need to screen pipes (|
→ {{!}}
) and carefully avoid extra spaces.
I've got the link to this community-portal from Clemonde and tried it on a fresh mediawiki with smw extension.
My sobobject tuples look like this.
{{#subobject: | Project = {{FULLPAGENAME}} | Year = 1995 | Role = Det. Mike Lowrey | Actor = Will Smith | Voice Actor = Leon Boden }} {{#subobject: | Project = {{FULLPAGENAME}} | Year = 1995 | Role = Det. Marcus Burnett | Actor = Martin Lawrence | Voice Actor = Torsten Michaelis }}
The following statement made it possible to put these subobjects in one table:
{{#ask: [[Actor::{{{Actor|+}}}]] | mainlabel= - | ?Actor | ?Role | ?Voice Actor | format = sortable | sort = Year | order = desc }}
What exactly does [[Actor::{{{Actor|+}}}]]
do? I red the user-manual but could not figured it out properly
I tried to write two actor/voice-actor/role tuple in one subobject. But as a result the site of the Actor/Voice-Actor did show all tuple and not just the one WHERE Actor.Name = Will Smith
The ask command in the actor template:
{{#ask: [[Actor::{{FULLPAGENAME}}]] | mainlabel=- | ?Year | ?Project | ?Role | ?Voice Actor | format = sortable | sort = Year | order = desc }}
Is there an easy way to fill the project table manually (by hand) and extract the needed data in the pages of Actor/Voice actor? A subobject for every tuple is a bit overwhelming.
Maybe a pseudo SQL statement helps:
SELECT Actor.Name, Role.Name, VoiceActor.Name FROM Project WHERE Actor.Name = Will Smith
> What exactly does [[Actor::{{{Actor|+}}}]]</code> do?
This is the
WHERE
clause of the query.
My example assumes that the
{{{#ask:…}}
statement is used on the template called, say Template:Actor's roles
, which receives Actor
as an argument: {{Actor's roles|Actor=John Smith}}
.
If
Actor
is not given ({{Actor's roles}}
), +
will be used to choose all role subobjects where Actor property is set.
Another possible solution is to use the page title as the default value for
Actor
argument: [[Actor::{{{Actor|{{FULLPAGENAME}}}}}]]
. In this case the template call on a page about an actor will look simply like this: {{Actor's roles}}
.