Wiki news items: Difference between revisions

From SaruWiki
Jump to navigation Jump to search
(Started)
 
(item added)
Line 8: Line 8:
  $smwgNamespacesWithSemanticLinks[NS_NEWS] = true;
  $smwgNamespacesWithSemanticLinks[NS_NEWS] = true;
  $smwgQDefaultNamespaces = NULL;
  $smwgQDefaultNamespaces = NULL;
Of course this section must occur after the line that enables SMW
Of course this section must occur after the line that enables SMW (''enableSemantics(<name>);'')
 
==News item==
To create a news item, we use a template that sets certain semantic parameters:
* headline:: of type string, contains the headline.
* newsdate:: of type date, contains the entry date of the news item.
* newsauthor:: of type string, contains the author of the news item.
* news expires:: of type date, contains the date at which the news item is no longer valid.
* newsblurb:: of type string, contains a short excerpt of the news item.
When called, the template sets the semantic properties, and produces the headline, the byline with author and dates, and a nice box containing the blurb.
 
To create a news item, we now create a new page in the News: namespace, invoke the template, and put the news item text below it.
 
==News form==

Revision as of 18:48, 27 December 2009

Namespace

To create the News: namespace, and have it recognized by SMW, we add to LocalSettings.php:

define("NS_NEWS", 112);
define("NS_NEWS_TALK", 113);
$wgExtraNamespaces[NS_NEWS] = "News";
$wgExtraNamespaces[NS_NEWS_TALK] = "News_talk";

$smwgNamespacesWithSemanticLinks[NS_NEWS] = true;
$smwgQDefaultNamespaces = NULL;

Of course this section must occur after the line that enables SMW (enableSemantics(<name>);)

News item

To create a news item, we use a template that sets certain semantic parameters:

  • headline:: of type string, contains the headline.
  • newsdate:: of type date, contains the entry date of the news item.
  • newsauthor:: of type string, contains the author of the news item.
  • news expires:: of type date, contains the date at which the news item is no longer valid.
  • newsblurb:: of type string, contains a short excerpt of the news item.

When called, the template sets the semantic properties, and produces the headline, the byline with author and dates, and a nice box containing the blurb.

To create a news item, we now create a new page in the News: namespace, invoke the template, and put the news item text below it.

News form