[pmwiki-users] FmtPV and conditionals

Patrick R. Michaud pmichaud at pobox.com
Fri Aug 25 13:39:54 CDT 2006


On Fri, Aug 25, 2006 at 03:20:36PM -0300, carlos.ab at gmail.com wrote:
> Is it possible to use this :
> 
> ------------------------------
> global $FmtPV;
> 
> if (defined('COMMENTBOXSTYLED_VERSION')){
> 	$FmtPV['$CommentBox'] = '1';
> }else{
> 	$FmtPV['$CommentBox'] = '0';
> }
> ------------------------------
> 
> Inside skin.php and use a conditional like this inside a page:
> 
> ------------------------------
> 
> (:if enabled {$CommentBox}  :)
> $[Comments] {$PostCount} - 
> (:ifend:)
> 
> ------------------------------
> 
> and have it working. because it is not working for me.

Well, that's confusing page variables with global variables a
bit ("enabled" works on global PHP variables, not page variables).
And, it seems like the long way around anyway.  Shorter ways
to do it:

1.  Define a "commentbox" condition

      $Conditions['commentbox'] = defined('COMMENTBOXSTYLED_VERSION');

    and then use 

      (:if commentbox:)
      $[Comments] {$PostCount} -
      (:ifend:)
   
2.  Check for the existence of some other variable set by 
    the commentbox recipe, such as $CommentBoxFmt:

      (:if enabled CommentBoxFmt:)
      $[Comments] {$PostCount} -
      (:ifend:)

Pm




More information about the pmwiki-users mailing list