Wiki source for AncestorPage


Show raw source

=====Tracking page modification=====

{{lastedit}}
<<This action checks whether selected page has been modified since the last edition of the current page. If yes, it shows a small text about the situation. The main goal of this action is to track changes which happen on wikka english documentation when user is surfing doc's translations.<<
>> Version: **0.3**>>
::c::

===Usage===

""{{pwancestor page="MyPage" show="yes|no"}}""

==Parameters==
- page: page to track.
- show: displays a notice even if tracked page wasn't modified after current page.

===The code===

%%(php)
<?php
/**
* Ancestor Action
* Displays sth is original page was modified after current one.
*
* @version 0.3
* @filename: pwancestor.php
* @author: PivWan
* @email: pivwan@gmail.com
* @date: 2005-06-22
* @license: GPL
*
*/

(!empty($vars['page'])) ? $ancestor=$vars['page']: $ancestor="HomePage";
(!empty($vars['show'])) ? $show=$vars['show']: $show="no";

// This action will be displayed only if on "show" mode.

if ($this->method == "show")
{
$ancestor_page = $this->LoadSingle("SELECT time FROM ".$this->config["table_prefix"]."pages WHERE tag='".$ancestor."' AND latest = 'Y' ORDER BY time desc LIMIT 1");

if($this->page['time'] < $ancestor_page['time'])
{
$output = "<div class=\"lastedit\">Ancestor: ".$this->Format("[[".$ancestor."]]")." has been modified since the last edition of this page!</div>";
}
elseif(( $this->page['time'] > $ancestor_page['time'] ) && ( $show == "yes" ))
{
$output = "<div class=\"lastedit\">Original page not modified.<br />Ancestor: ".$this->Format("[[".$ancestor."]]")." </div>";
}
print $output;
}
?>
%%

===Todo===

- Default value if no page is passed in parameter. If current page is WikkaDocumentationFR, it will link to WikkaDocumentation.

----
CategoryUserContributions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki