[pmwiki-users] Truncate PageTitle
Peter Bowers
pbowers at pobox.com
Mon Aug 20 09:04:20 CDT 2012
Did the $FmtPV definition work? Or were you hoping for something
markup-expression related?
Writing a strpos() in MX is fairly simple:
$MarkupExpr['strpos'] = 'strpos($args[0], $args[1])';
# $MarkupExpr['add'] = '$args[0] + $args[1]'; // MarkupExprPlus
version is better, this will work
Then in page source:
{(substr "{$Title}" (add 2 (strpos "{$Title}" "-")))}
You have to add 2 because of the space after the dash. If you search
for space-dash-space then you would add 3...
Be aware that if an author doesn't title a page just right the results
could be unacceptable...
-Peter
On Mon, Aug 20, 2012 at 3:18 PM, Brian Tibbels
<brian.tibbels at clickmarlow.co.uk> wrote:
> Unfortunately the "Language" part is variable in length. I suppose I'm
> looking for the equivalent of a "strpos" in expressions.
More information about the pmwiki-users
mailing list