[pmwiki-users] Bug: $LastModified page variable picking up last but one modification date/time not current one

Petko Yotov 5ko at 5ko.fr
Wed Jul 15 10:57:14 CDT 2009


On Wednesday 15 July 2009 16:17:50 stevecrisp at gmail.com wrote:
> Spotted an issue with the $LastModified page variable picking up last but
> one modification date/time not current.  This is only the case when used in
> (:description:) markup in conjection with hover/tooltip text.  Let me
> explain my set-up....
>
> PmWiki latest 2.2.0
>
> Added tooltips to Wiki page links. Tooltip is taken from the text within
> the (:description:) markup for each page it links to. This is what was
> added to the local/config.php file:
>
> $LinkPageExistsFmt = "<a class='wikilink' title='{\$Description}'
> href='\$LinkUrl'>\$LinkText</a>";
...
> (:description My Page 2 - last modified on {$LastModified} by
> {$LastModifiedBy} :)

This happens because the $Description variable is evaluated as text before the 
page is saved to a file, not when it is requested. And before the page is 
saved, the $LastModified and $LastModifiedBy variables contain the previous 
timestamp and the previous author.

If you set the part "last modified on {$LastModified} by {$LastModifiedBy}" in 
the title= attribute of the link, it should work :

$LinkPageExistsFmt="<a class='wikilink' title='{\$Description} - last modified 
on {\$LastModified} by {\$LastModifiedBy}' href='\$LinkUrl'>\$LinkText</a>";

(:description My Page 2:)

Note that having apostrophes in your description may break your link titles 
and produce invalid HTML. You can fix this by adding to config.php :

  $FmtPV['$Description'] = 'htmlspecialchars(@$page["description"],
    ENT_QUOTES)';

Petko



More information about the pmwiki-users mailing list