Revision [5322]

This is an old revision of BacklinksHandler made by DarTar on 2005-01-28 11:52:14.

 


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://wakkawiki.de/MartinBurger Martin Burger} - original code.
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli} - minor modifications, ExistsPage check added.
* @version 0.2
* @since Wikka 1.1.6.X
*
* @todo
*
*/

echo $this->Format('=== Pages linking to '.$this->tag.'=== --- ---');
    if ($pages = $this->LoadPagesLinkingTo($this->getPageTag())) {
        foreach ($pages as $page) {
            if ($this->ExistsPage($page['tag'])) {
                $links[] = $this->Link($page["tag"]);
            }
        }
        print(implode("<br>\n", $links));
    } else {
        print("There are no backlinks to this page.");
    }
?>
</div>



CategoryDevelopment
There are 15 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki