Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

MarkupExprPlus-Talk

Summary: Talk page for MarkupExprPlus.
Maintainer: Dfaure
Users: +1 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Along with the rev and rot13 functions an md5 function could be useful. Maybe keep it in mind for a future version of the recipe.

Blues September 18, 2007, at 04:29 AM

For now, you only need in your configuration file:
$MarkupExpr['md5'] = 'md5($args[0])';
include_once("$FarmD/cookbook/markupexprplus.php");
Dfaure September 18, 2007, at 08:09 AM

Is there a reason these expressions are called through a separate markup function rather than through the built-in $MarkupExpr array? I'd like to be able to use one or two of these without having to install the whole recipe. BenStallings

The "separate markup function" is only a drop-in replacement of the original one defined in the core which hasn't been tailored to handle complex expressions. Feel free to "extract" the expressions token definitions you need and make your own (sub)recipe with them --Dfaure March 03, 2008, at 03:35 PM

hi, is it possible to cut a Variable by String? for example: My Pagename "$Name" is Word1Word3. Now I´m searching for a solution to cut the variable infront of the String "Word3". My Problem - the Variable "$Name" can changed to "Word200"..., but the string "Word3" is set. Hope you can help me. Hendrik June 17, 2008, at 07:23 AM

This is a perfect job for a regular-expressions replacement such as: {(reg_replace '/(?:.*)(Word3)/' '$1' '{$Name}')} --Dfaure June 18, 2008, at 06:55 AM

Dfaure, Could you add a mathematical operator to determine if a number is even or odd? It appears to be a simple PHP operation, but I'm no PHP programmer! I'm trying to create a Pagelist template with alternating (Zebra) background colors. The Pagelist variable, {$$PageCount}, already provides the iteration number. If an even/odd boolean function existed, then conditional markup could be used to alternate the colors. --CRAjr July 17, 2008, at 8:37 AM

Have you looked at FormattingTables? The method for zebra tables works with simple table markup, even if you use it in a pagelist template. HansB
The function already exists, "mod" (modulo, remainder). You can use {(mod {$$PageCount} 2)} to print alternatively "0" or "1", {(mod {$$PageCount} 3)} to print "0", "1" or "2" etc. --Petko
Excellent! You guys are the best! Hans, I have successfully created zebra tables in the past, and that's what I first attempted. But, I was unable to get it to work in a pagelist. I'll have to go back and try again. Meanwhile, Petko, your solution works perfectly. -- CRAjr

I am trying to add Gravatar to Fox Comments, for this a conditional expression is needed along with MD5. The problem is that the (md5 {$$email}) in the else condition appears as-is in the output due to the keep function. Is there any facility to allow expressions inside the arguments to the if, or any better implementation? My code is:

{$$(if (test equal '{$$email}' '') 'http://www.gravatar.com/avatar.php?size=20&d=identicon&foo.png'
'http://www.gravatar.com/avatar.php?gravatar_id=(md5 {$$email})&size=20&d=identicon&foo.png' )}

--Kartik Feb 4, 2009

Talk page for the MarkupExprPlus recipe (users).

Edit - History - Print - Recent Changes - Search
Page last modified on September 10, 2011, at 11:42 AM