Topic on Extension talk:Semantic Glossary

Jump to navigation Jump to search

Creating Form inputs for glossary terms

7
Nprobinson (talkcontribs)

On the Semantic_Glossary overview it mentions that "You can easily build a user interface to edit the glossary, e.g. using Semantic Forms.".

Does anyone have any more information than this regarding how to set the required objects up? I have tried different combinations of creating templates, forms and categories but can't find anyway of populating the 'Glossary-Term', 'Glossary-Definition' etc values via an input form?

Thanks in advance for any suggestions and apologies if I am missing a glaringly obvious solution somewhere.

Cavila (talkcontribs)

Just a quick answer with an example, presuming you have installed SMW, SF and SG properly:

Say you have something like the following in a template called "Template:Glossary term" (subobjects are used here as recommended by the docs):

=={{{Term|}}}==
{{{Definition|}}} (link: {{{Link|}}})
{{#subobject:
|Glossary-Term={{{Term|}}}
|Glossary-Definition={{{Definition|}}}
|Glossary-Link={{{Link|}}}
}}

Then in the form you may want to use multiple-instance templates:

{{{for template|Glossary term|multiple}}}
===Term===
{{{field|Term|input type=text}}}

===Definition===
{{{field|Definition|input type=textarea}}}

===Link===
{{{field|Link|input type=textarea}}}

{{{end template}}}

Does that help you in any way?

F.trott (talkcontribs)

Create a page Category:Glossary Term:

[[Has default form::Glossary Term]]

Create a page Template:Glossary Term:

{{#set:
|Glossary-Term={{{Glossary Term|}}}
|Glossary-Definition={{{Glossary Definition|}}}
}}

Create a page Form:Glossary Term:

<noinclude>

{{#formlink:form=Glossary Term|link text=New Glossary Term}}

</noinclude><includeonly>
{{{info|create title=Create new Glossary Term|edit title=Edit Glossary Term|page name=<Glossary Term[Glossary Term]>}}}
{{{for template|Glossary Term}}}
{| class="formtable"
! Term:
| {{{field|Glossary Term|input type=text}}}
|-
! Definition:
| {{{field|Glossary Definition|input type=textarea}}}
|}
{{{end template}}}

{{{standard input|save}}} {{{standard input|cancel}}}
</includeonly>

Follow the link on the Form page and create some terms.

It may be necessary to purge the pages containing text with terms.

F.trott (talkcontribs)

Heh, mid-air collision. :)

Both should work. Cavila's for one page containing several terms (up to the whole glossary), mine for one page per term.

Nprobinson (talkcontribs)

Thanks for the responses.

I ended up implementing the one page per term as it fitted my requirements better but thank you both for the guidance.

Solution worked perfectly.

Kmlancaster (talkcontribs)

When I follow your example, I get the following as the only visible content on my Form:Glossary Term page. Any help?

{{#formlink:form=Glossary Term|link text=New Glossary Term}}

F.trott (talkcontribs)

Usually when a function call appears verbatim on the page it means, that the respective function is unknown. Make sure that PageForms is installed properly.

Reply to "Creating Form inputs for glossary terms"