[pmwiki-users] Is there a way to have a "default" markup for an unknown or empty page text variable?
Peter Kay
pkay42 at gmail.com
Wed Oct 30 10:34:05 PDT 2019
So for multiple languages, one would say
$DefaultUnsetPageTextVars['AdminTasks'] =
'[[SiteAdmin.Tasks?action=login|'.XL('login to see your tasks').']]';
?
On Wed, Oct 30, 2019 at 5:56 AM Petko Yotov <5ko at 5ko.fr> wrote:
> I've added this for 2.2.121 (you can get the pre-release as a ZIP file
> or from Subversion here:
>
> https://www.pmwiki.org/wiki/PmWiki/Subversion
>
> Only pmwiki.php was modified for this feature since 2.2.120.
>
> The documentation for this is here:
>
> https://www.pmwiki.org/wiki/PmWiki/PageTextVariables#default
>
> Note that it doesn't distinguish "var not defined in page" from "user
> has no permissions for page". But if you *know* that a specific variable
> *is* defined in a specific protected page and it looks like unset, then
> the user doesn't have read permissions.
>
> For example, in config.php:
>
> $DefaultUnsetPageTextVars['AdminTasks'] =
> '[[SiteAdmin.Tasks?action=login|login to see your tasks]]';
>
> then e.g. in Site.SideBar:
>
> {SiteAdmin.Tasks$:AdminTasks}
>
>
> With earlier PmWiki versions you could use a conditional:
>
> (:if auth read SiteAdmin.Tasks:)
> {SiteAdmin.Tasks$:AdminTasks}
> (:else:)
> [[SiteAdmin.Tasks?action=login|login to see your tasks]]
> (:ifend:)
>
> If the value is a single line without quotes, you could alternatively
> use:
>
> (:if equal "" "{SiteAdmin.Tasks$:AdminTasks}":)
> (no permissions)
> (:ifend:)
>
> See:
>
> https://www.pmwiki.org/wiki/PmWiki/ConditionalMarkup#built-in-conditions
>
> Petko
>
> --
> If you upgrade : http://www.pmwiki.org/Upgrades
>
>
> On 29/10/2019 22:35, Christopher Cox wrote:
> > Is there a way to have a "default" markup for an unknown or empty page
> > text variable?
> >
> > Specifically, might be nice for "something" to show up for a PTV for
> > which somebody can't access because of permissions, but I'm ok with
> > some sort of general case. Possible?
> >
> > I'm ok with enabling such via special per group/page php.
> >
> > But doesn't seem possible at all today? Like a
> > PCache[pagename]["=p_<whatever>] default set in PageTextVar even for
> > situations where the PCache can't be fetched due to permissions.
> > Something like that.
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20191030/09e2ffc2/attachment.html>
More information about the pmwiki-users
mailing list