[pmwiki-users] Is there a way to have a "default" markup for an unknown or empty page text variable?

Petko Yotov 5ko at 5ko.fr
Wed Oct 30 02:56:07 PDT 2019


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.



More information about the pmwiki-users mailing list