[pmwiki-users] Can a markup function set $HTMLHeaderFmt?

SteP step.list+pmwiki at gmail.com
Wed Sep 6 17:59:01 CDT 2017

I haven't scripted PmWiki in quite a while, now I need to add a recipe to an
older pmwiki version 2.2.43 
and I'm having second thoughts. Can a markup function set $HTMLHeaderFmt? Can it always or are there 
restrictions?  I ask because what I see happening with this recipe 
http://www.pmwiki.org/wiki/Cookbook/AddThisWidget-Talk (the one by Carlos AB) is weird and puzzles 
me. If I put the markup (:addThis :) directly in a wiki page then all is well: a "Share" button is rendered 
and hovering over it pops up a menu from http://s7.addthis.com/js/250/addthis_widget.js. However, if I 
put the same markup in an included file, such as Site.Sidebar, or Main.GroupHeader, 
the button is still 
rendered but addthis_widget.js isn't downloaded at all, so the menu is missing. This happens, I think, 
because the element $HTMLHeaderFmt['addthis'] == "\n" (see the code below) instead of carrying the 
<script> tags that should go into the <header>.  What's going on?  Thank you in advance for your 

The relevant recipe code is summarized like so:

SDV($AddThisProfile , "<script type='text/javascript'>
var addthis_config = {
     pubid: 'profile'
SDVA($AddThisButton , array(
"<a class='addthis_button' 
   <img src='http://s7.addthis.com/static/btn/sm-share-en.gif' 
      width='83' height='16' alt='Bookmark and Share' style='border:0'/>
SDV($AddThisMenu , "<script type='text/javascript' 

  '/\\(:addthis\\s(.*):\\)/ei',"AddThisWidget(\$pagename, PSS('$1'))");

function AddThisWidget($pn,$a){
global $AddThisProfile,$AddThisButton,$AddThisShare,$AddThisMenu,$HTMLHeaderFmt;

$args = ParseArgs($a);
$HTMLHeaderFmt['addthis'] = "\n".$AddThisProfile.$AddThisShare.$AddThisMenu;

return Keep($AddThisButton[$button]);

More information about the pmwiki-users mailing list