Module Attributes via URL

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

: attributes dynamic module parameters url

rating: +7

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 URL
Module Yes No
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 date, limit, nextBy, order, p, perPage, previousBy, t, tag, tags, tagTarget, created_by, 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, tag, tags, 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

ErichSteinboeck ErichSteinboeck . Please visit his/her userPage.


Related articles

Comments

Module attributes via URL - ListPages offset ?
gerdami gerdami 16 Jan 2009 21:53

Erich,
Have you found a way to simulate the offset attribute which is available with the Feed module but not with the ListPages module ?

by gerdami gerdami , 16 Jan 2009 21:53
Module attributes via URL - ListPages offset ?
ErichSteinboeck ErichSteinboeck 17 Jan 2009 12:42

> a way to simulate the offset attribute which is available with the Feed module
Only in a rather crude way. Back in June last year I posted a suggestion in a thread that discussed how to break up ListPages output into chunks.

by ErichSteinboeck ErichSteinboeck , 17 Jan 2009 12:42
What does it mean " Specify "@URL" as the module tag parameter value"
skydiver000 skydiver000 28 Sep 2012 14:56

I tried to pass tag via URL

http://sky-tests.wikidot.com/last-pages/tag/hi

it did not work

tha only parameter I can pass is "p", like

http://sky-tests.wikidot.com/last-pages/p/4

how can I pass "created_at" ?

like

http://sky-tests.wikidot.com/last-pages/created_at/last%201%20week
http://sky-tests.wikidot.com/last-pages/created_at/last%204%20week

nevermind, I think I got it

[[module ListPages separate="no" tag="@URL" perPage="5" created_at="@URL"]]
* %%title_linked%%
[[/module]]
Last edited on 28 Sep 2012 15:08 by skydiver000
by skydiver000 skydiver000 , 28 Sep 2012 14:56
Footnotes
. The list includes attributes that aren't documented officially
. The list includes modules that aren't documented officially
. Although some of these attributes (e. g. MiniRecentPosts or TagCloud attributes) are read in via URL, nevertheless they don't work properly when specified via URL
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
. Specify "@URL" as the module tag parameter value
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).
Notify administrators if there is objectionable content in this page.
Something does not work as expected? Find out what you can do.
General Wikidot.com documentation and help section.
Wikidot.com Terms of Service - what you can, what you should not etc.
Wikidot.com Privacy Policy.

AltStyle によって変換されたページ (->オリジナル) /