DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:varlinks

Variable Links Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" yes
  • 2015-08-10 "Detritus" unknown
  • 2014-09-29 "Hrun" unknown

plugin Adds an alternative links syntax allowing dynamic variables passing.

Last updated on
2016-07-25
Provides
Syntax
Repository
Source

Similar to linkway, var

Tagged with !newbie, date, email, links, macro, navigation, page, users

:!: Warning! Working, but non-stable and still in development!

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Examples/Usage

Let's suppose, the page was created by the user One, while the user Two is reading it after construction.

User One writes in the page code:

[<private:@USER@:$USER$:message|Hey, write me!>]

User Two reads it few moments later, he clicks a mentioned link, which leads him to private:One:Two:Message, just like if it was Hey, write me!:

[[private:One:Two:message|Hey, write me!]]

Something like that…

Syntax

Actually, it is a bit wider already… but this is the only part I've tested yet:

[<link|title>]
[<link>]

Here title is text title of the link (can be absent as well). I am a very newbie, so currently I'm just trying to understand how to detect which type of content is in title (any help?:)… So for now it can feed text titles only.

params can be nocache (may be there should some more params later) in order to enforce wiki not to cache the page with this link.

And, finally, link is an internal page link or external link (type detection is still… much rude). The main feature of the plugin is that link may contain variables from the table below (yeah, cut from var).

@variables@ are set during page editing, so if you write @USER@, that means there will be your user ID in a link when the page is read.

$variables$ are set during page view, so if you write $USER$, that means there will be viewing user ID in the link when the page is read.

Also, you can set non-standard $variables$ like $hello$ to the link. By default, it will be replaced with its text part (hello for $hello$), but if you feed your page with POST/GET hello=someValue, there will be someValue in the link instead.

:!: Warning! Disabling cache is slowing down the page load. And for now I've not balanced yet all the situations when it is really needed, so… Yeah, it loves disabling your page caching)

@ID@, $ID$ full ID of the page
@NS@, $NS$ namespace of the page
@PAGE@, $PAGE$ page name (ID without namespace and underscores replaced by spaces)
@USER@, $USER$ ID of current user
@NAME@, $NAME$ full name of current user
@MAIL@, $MAIL$ mail address of current user
@DATE@, $DATE$ current date
@YEAR@, $YEAR$ current year in YYYY format
@MONTH@, $MONTH$ current month in MM format
@DAY@, $DAY$ current day in DD format
@TITLE@, $TITLE$ first heading of the current page
@WIKI@, $WIKI$ title of the wikis as configured in title
@SERVER@, $SERVER$ the content of $_SERVER['SERVER_NAME']

ToDo/Wish List

  • Images in title field support
  • More [[links]]-like syntax
  • Link inline conditions for links altering
  • Code washing
  • Cache disabler balancing

Discussion

Actually, I am in the very beginning of both DokuWiki and PHP at all, so… code works, but it is still awful and here is a lot of work to do. God, this thing is composed of other plugin' pieces… So… Any help is appreciated.

I haven't managed to find acceptable analogs for this, so had to make this one (for my own usage at least). If you know the one, plz, mail to stop me from the time wasting :)


plugin/varlinks.txt · Last modified: 2016-07-25 11:40 by Erandelax