How do you recommend updating a recipe that uses eregi?

eprecated: Function eregi() is deprecated in /home/ttcorgnz/public_html/pmwiki/cookbook/totalcounter.php on line 228

Rewrite your script to use preg_match(), see --Petko July 21, 2014, at 07:32 AM

If you want a markup to produce something that is interpreted by wiki be careful. E.g. if I you want a style, I start by coding

  • Markup('{red}', '_begin', '/{red}/', '>>red<<');

However, PmWiki will show the text >>red<< instead of interpreting the style and changing the color. This is because the markup handling styles looks for &lt;&lt; .... &gt;&gt; . Thus, what I need is

  • Markup('{red}', '_begin', '/{red}/', '&lt;&lt;red&gt;&gt;');

To make sure the ouput of a markup is understood, one better reads the definition of the consumer, in this case in stdmarkup.php.

parallel use of the " <br> " symbol, to break lines

If you want to use the " <br> " symbol, to break lines,
like in .html pages
(parallel to the " \\ " symbol),
put the following in your config.php file:

## using <br> , to break lines.
## optional, if you may have <br clear='all'>
## Markup('<br clear=all>','inline','/&lt;br\\s+clear=([\'"]?)all\\1\\s*\\/?&gt;/i',"<br clear='all' />");
## One thing to know is that the symbols "<" and ">" are encoded in the page 
## source text as "&lt;" and "&gt;" and in custom markup the encoded ones should 
## be used.
Markup('<br>','inline','/&lt;br\\s*\\/?&gt;/i',"<br />");

How can I use Custom MarkUp Directives that include JavaScript references that use single and double quotes?

Well, now this one is tricky. Short answer is, inside the double quotes, only use single quotes and it should work fine. On a live site, one issue that was encountered was the inclusion of PHP scripting to perform text replacement inside JavaScript to add a username to the session of the site from the originating site if the _SESSION['username'] variable was already set on the site. Unfortunately, since the code markup to be retained was using double quotes to encapsulate the code, the inner code needed to use all single quotes which included the PHP markup as well. Theoretically, single back-quotes could have been used for the _SESSION array element perhaps, but mixing as little as possible will be more solid in the code base since there are so many with which to start. So, no pre-assigned username, but the rest works fine. (Also, in this example, the end credits tagline was reduced even though it could very well have been retained.

Markup('support', 'directives', '/\\(:support:\\)/', 
Keep("<!-- Powered by: Support Site Live Help Credits -->
<div id="supportsite">
<script type="text/javascript" 
echo'$_SESSION['username']'?> "></script>
<br><font style="font-family: verdana, helvetica, sans-serif; font-size: 8px; color: #000000;">Powered By:</font>
<a href="" alt="Support Site Live Help" target="_blank" 
style="font-family: verdana, helvetica, sans-serif; font-size: 10px; color: #11498e; text-decoration: none; 
font-weight: bold;">SupportSiteCredits</a>
<!-- copyright credits -->") );
Markup('support', 'directives', '/\\(:support:\\)/', 
Keep("<!-- Powered by: Support Site Live Help Credits -->
<div id='supportsite'>
<script type='text/javascript' 
<br></div> <!-- copyright credits -->") );

This is a talk page for improving PmWiki.CustomMarkup.