For enhancing the aspect of the opensuse pages, the use of images is very nice. However, mediawiki images use to link only to they own page, so clicking on the image don't send to the link waited by most users (the normal icons way);

I asked about this on the mediawiki list and was answed this (below).

could somebody test this and if good insert the appropiate code? I've no php knowledge and can't do it myself

thanks
jdd

-------- Original Message --------
Subject: Re: [Mediawiki-l] using images as icons
Date: Tue, 30 Aug 2005 12:04:04 -0700
From: Joshua Oreman <[EMAIL PROTECTED]>
Reply-To: MediaWiki announcements and site admin list <[EMAIL PROTECTED]> To: MediaWiki announcements and site admin list <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

On 8/30/05, Sy <[EMAIL PROTECTED]> wrote:
On 8/30/05, jdd <[EMAIL PROTECTED]> wrote:
> is there a way to use images as icons, that is clicking on
> the image drives to an other page, not the image page.

Did some more thinking.. the only solution I can see is some kind of
extension designed to do this.

Yep.
Untested, but should work.

extensions/ImageLink.php:
--snip--
require_once('../includes/Image.php');

$wgExtensionFunctions[] = "wfImageLink";

function wfImageLink()
{
    global $wgParser;
    $wgParser->setHook ('imglink', 'renderImageLink');
}

function renderImageLink ($text, $attr)
{
    global $wgParser, $wgUser, $wgTitle;
    $parserOptions = ParserOptions::newFromUser( $wgUser );
    $parser =& new Parser();
$output =& $parser->parse("[[".$input."|IMAGE]]", $wgTitle, $parserOptions);
    $ret = $output->getText();
    $itag = "<img border='0' ";
    foreach ($attr as $k => $v) {
        if ($k == "src") {
$itag .= "src='" . Image::imageUrl($attr['src']) . "' ";
        } else {
            $itag .= "$k='$v' ";
    }
     $itag .= "/>";
    return str_replace ($ret, "IMAGE", $itag);
}
--snip--
and add
  require_once('extensions/ImageLink.php');
to LocalSettings.php.

To use, do
<imglink src='MyImage'>Destination page</imglink>
instead of the doesn't-work
[[Destination page|[[Image:MyImage]]]]
You can also use height and width attributes on the <imglink> tag.

Hope this helps.
-- Josh

_______________________________________________
MediaWiki-l mailing list
[EMAIL PROTECTED]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

_______________________________________________
MediaWiki-l mailing list
[EMAIL PROTECTED]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l



--
pour m'écrire, aller sur:
http://www.dodin.net
http://valerie.dodin.net
http://arvamip.free.fr

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to