Module Attributes via URL

Posted by ErichSteinboeck on 28 Jun 2008 17:32, last edited by Venryx on 16 Dec 2012 00:52

Tags: attributes dynamic module parameters url

rating: +6+x

For most Wikidot module calls you can specify (module-specific) attributes (names and values) on the [[module …]] call. An example would be [[module PageTree depth="1"]], where “depth” is the attribute name and “1” its attribute value.

Unspecified attributes take on their default values.

Some of those attributes, if either

  • not specified on the [[module …]] call, or
  • for recently changed modules ListPages and PageCalendar, specified with the special parameter value “@URL”

can have their attribute values specified dynamically via the calling URL (Uniform Resource Locator).

How it Works

The syntax for dynamically specifying module attribute values via the calling URL is
http://wiki-name.wikidot.com/page-name/attribute-name/attribute-value, where

  • wiki-name is the name of your Wiki
  • page-name is the name of the page, where the call to the module (whose attribute you'd like to specify) is coded,
  • attribute-name is the name of the attribute you'd like to specify
  • attribute-value is the value that attribute-name should take on

Wikidot itself uses URL-specified attributes in many places. For example:

  • Search. Module “Search” has an attribute “q” (whose value is the string that Search should search for), that normally isn't specified on the [[module Search]] call. As the page search:site usually contains a call to [[module Search]], you can call http://wiki-name.wikidot.com/search:site/q/search-value to search for the string search-value.

  • Pagination. Modules like ForumCategory, ListPages, or Search that support automatic pagination use attribute “p” to specify the number of the page to display (…page-name/p/page-nr)

  • Redirect. If attribute “noredirect” specified via the URL as …page-name/noredirect/true module Redirect will not redirect.

Which Module Attributes Can be Specified Dynamically?

Not all module attributes can have their attribute values specified dynamically. To find out which can, see the following list:

Attribute Can be Specified via URL1
Module2 Yes No3
Comments comments hide, title
Feed module_body limit, offset, src
FlickrGallery contentOnly, disableBrowsing, groupId, groupUrl, limitPages, pageNumber, perPage, photosetId, size, sort, tagMode, tags, userName
ForumCategory c, p, sort
ForumNewThread c, title
ForumStart hidden
ForumThread t
FrontForum category, feed, feedDescription, feedTitle, limit, module_body, offset
ListPages date4, limit5, nextBy6, order7, p, perPage8, previousBy9, t, tag10, tags11, tagTarget12, created_by13, urlAttrPrefix appendLine, categories, category, module_body, prependLine, rss, rssTitle, separate, skipCurrent
ManageSite start
Members from group, showSince
MiniActiveThreads limit
MiniRecentPosts categoryId, limit
MiniRecentThreads limit
NewPage button, category, format, size, style, template
NextPage by
PageCalendar date, tag14, tags15, urlAttrPrefix categories, category, startPage, targetPage
Pages category, details, limit, order, preview
PagesByTag category, t, tag
PageTree depth, root, showRoot
PetitionAdmin withoutBox
PetitionList id, limit
PreviousPage by
Rate pageId
RatedPages maxRating, minRating, order category, comments, limit
Redirect destination, noredirect
Search a, mini, p, q
SearchAll a, p, q
SearchUsers p, q
SignPetition confirm, id
SimpleToDo id
SitesListByTag lang, tag, title
TagCloud categories, category, limit, maxColor, maxFontSize, minColor, minFontSize, target
ThemePreviewer noUi, theme_id

Example

This example shows how you can let users choose a page for which they'd like to display a “PageTree” site map.

To see the different results, click on the How-To Topics, Community How-To's, and Welcome links shown.

What you type … What you get …
Show site map for top-level page \
[/howto:module-attributes-via-url/root/howtotopics:page-content How-To Topics], \
[/howto:module-attributes-via-url/root/howto:howto-list Community How-To's], \
[/howto:module-attributes-via-url/root/start/depth/1 Welcome] (first level only)
[[module PageTree showRoot="yes"]]

Show site map for top-level page How-To Topics, Community How-To's, Welcome (first level only)

Links

For an application of this idea see Sortable List of Pages

Backlinks

Author

ErichSteinboeckErichSteinboeck. Please visit his/her userPage.


Related articles

Comments

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.