Backlinks Handler
This feature was implemented in the 1.1.6.2. release
This is the development page for the backlinks handler.
Nothing more than a couple of minor modifications to the
WakkaBacklinksHandler.
The handler shows a
list of pages linking to the current page.
Given the strong page-dependence of this function, I think it makes more sense to have it work as a
handler than an
action.
To install it just save the code block below as
handlers/page/backlinks.php
Use it as any other handler, appending
/backlinks to the page URL.
Note: the backlinks handler is available for testing on this server.
<div
class=
"page">
<?php
/**
* Displays a list of internal pages linking to the current page.
*
* Usage: append /backlinks to the URL of the page
*
* This handler retrieves a list of internal pages linking to the current page.
* It first checks if they exist and prints them on the screen.
*
* @package Handlers
* @subpackage
* @name backlinks
*
* @author {@link http://web.archive.org/web/20040823065044/http://www.wakkawiki.com/MartinBurger Martin Burger} - original idea and code.
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli} - code rewritten, ExistsPage check added, removed links array.
* @version 0.3
* @since Wikka 1.1.6.X
*
* @todo
*
*/
// User-interface: strings
define('PAGE_TITLE',
'Pages linking to %s');
define('ERROR_NO_BACKLINKS',
'There are no backlinks to this page.');
// build backlinks list
echo $this->
Format('=== '.sprintf
(PAGE_TITLE,
'[['.
$this->
tag.
']]').
' === --- ---');
if ($pages =
$this->
LoadPagesLinkingTo($this->
tag)) {
foreach ($pages as $page) {
if ($this->
ExistsPage($page['tag'])) {
print $this->
Link($page['tag']).
'<br />';
}
}
} else {
print ERROR_NO_BACKLINKS;
}
?>
</div>
CategoryDevelopmentHandlers