[pmwiki-devel] Calling a non existent function from a skin tempate

Patrick R. Michaud pmichaud at pobox.com
Mon Jan 29 14:57:54 CST 2007


On Mon, Jan 29, 2007 at 09:34:40PM +0100, Dfaure wrote:
> On 1/29/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> >On Fri, Jan 26, 2007 at 07:09:37AM +0100, Dfaure wrote:
> >> If I put a line like:
> >>     <!--function:MyFunction ...-->
> >> into a skin template, without having the function effectively defined,
> >> I get the function call itself output as a string during the page
> >> rendering, stripped of the html comment marks.
> >> If this approach seems good during skin development, I don't think it
> >> should be kept on production site.
> >
> >What should be done instead?  Simply ignore the directive?
> >That seems wrong somehow, certainly wrong as a default.
> >
> >Perhaps we should define an $EnableProductionSite configuration
> >variable that tells various functions not to report errors and
> >to try to make things look as clean as possible whenever it
> >is set.
> 
> Can't we use $EnableDiag for that?

$EnableDiag is disabled by default (as it should be).  Creating
a custom skin is a fairly common operation for a new admin,
and I think PmWiki's defaults should provide new admins
with as many hints as to what may be going wrong as possible.
(Very few new admins try $EnableDiag when they encounter problems,
as evidenced by the questions we get on pmwiki-users where people
haven't tried that.)

I just have the feeling that there are at least three distinct 
levels going on here:  

  default - make it easiest for an admin to get things up and 
      running for most common issues
  diagnostic - debug particularly tricky problems and issues, even if
      it exposes a bit more information about the site
  production - make things appear as seamless and error-free
      as possible for non-admins, even if this means suppressing
      information that could help an admin diagnose a problem

But stepping away from default/diagnostic/production,
perhaps another approach is to simply have 
<!--function:NoSuchFunction 1--> replace itself with an
HTML comment in the output that says "NoSuchFunction undefined".
People just browsing the site won't see it, and admins who are
trying to figure out why they aren't getting anything will
see the comment in the output when they view the HTML source.

And perhaps $EnableDiag = 1 would cause the "NoSuchFunction undefined"
message to not be an HTML comment, so it'd be more "in your face"
to the administrator.

Pm



More information about the pmwiki-devel mailing list