Module exporting some symbols into its body and rendering it
Gabrys wrote on 16 Dec 2009 16:58
First of all — I have no idea of proper name for this module.
The module have no parameters and renders the module's body replacing some symbols with certain values:
symbol | value |
---|---|
%%user_id%% | ID of the user currently logged in |
%%user_title%% | printed name of the user currently logged in |
Examples
Application of %%user_id%%
%%user_id%% can be used to generate a link to current user profile page. Given profiles are stored in "profile" category, the code to do this can be:
[[module NameOfModule]]
Please [/profile:%%user_id%%/edit/true | edit your profile].
[[/module]]
This can be put on welcome page for new members.
Application of %%user_title%%
[[module NameOfModule]]
Wherever you see [[*user %%user_title%%]] it's your "avatar" that people can click and see your recent contributions, forum postings, etc.
[[/module]]
Comments: 7
page revision: 2, last edited: 18 Dec 2009 08:53
The %%user_id%% variable sounds great, because the title of a profile page could then be used to show their name on the page instead of just an ID. For non-Pro users though, %%user_title%% (i.e. username) might also be useful.
A slight tangent:
The %%created_by_id%% variable would be most useful to me if it worked inside the ListPages module, but I think this idea would be best made into something like a "PageVariables" module, where all supported variables (including %%created_by_id%%) will work directly on the page, without having to use them in a Live Template as we do now.
[[module PageVariables]]
leiger, %%user_id%%
Gabrys, %%created_by_id%%
%%title%%
%%site_subdomain%%
[[/module]]
Would appear as:
leiger, 32953
Gabrys, 2462
Module exporting some symbols into its body and rendering it
projects
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Instead of using PageVariables, I would rather allow ListPages to select own page. This seems counter-intuitive at first, but in fact is simpler to learn as everyone already uses ListPages module.
"pages" parameter could be used to select certain pages, like pages="start welcome other-page", or current page: pages="." or parent page: pages=".." or both current, parent and some other pages (doesn't make big sense, just for being consistent): pages=". .. start".
EDIT: this is not completely correct: you won't be ever able to use %%user_id%% in ListPages (because of ineffective caching).
Piotr Gabryjeluk
visit my blog
What does this module actually do? The name should reflect that. It renders content by replacing symbols. I assume you'll support all the variables that ListPages also handles, except those particular to ListPages (such as counters).
Good names could therefore be "template" or "format" or "render".
Portfolio
Or "show" or "display" or "extract" maybe?
Sue
Discussing further with Piotr, we realize this is just a special case of the ListUsers module, where the selector is "current user"…
Portfolio
… and as such, this design is deprecated by merging type="current" into ListUsers Module
Piotr Gabryjeluk
visit my blog
Or that… would work just as well xD
I'll close this thread then. Seems like the logical thing to do.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)