Hay en estas esquinas un rumor...

Positioning the frame of extension Anysite

⇠ Back to Blog:Hacks

This is a trivial patch of MediaWiki Extension:Anysite to shift x-wise the included frame. <?php

  1. Minseong Extension
  2. Tag :
  3. <anyweb>website</anyweb>
  4. Ex :
  5. from url http://aurora1.sourceforge.net
  6. <anyweb>http://aurora1.sourceforge.net</anyweb>
  7. <anyweb mywidth="800" myheight="600" myshift="30">http://my.server.com/</anyweb> to shift x-wise -- F.P.L. laussy.org
  8. Enjoy !

$wgExtensionFunctions[] = 'wfanyweb'; $wgExtensionCredits['parserhook'][] = array(

       'name' => 'anysite extension',
       'description' => 'Display sites',
       'author' => 'Minseong Kim and Others',
       'url' => 'http://www.mediawiki.org/wiki/Extension:Anysite'

);

function wfanyweb() {

       global $wgParser;
        $wgParser->setHook('anyweb', 'renderanyweb');

}

  1. The callback function for converting the input text to HTML output

function renderanyweb($input, $argv) {

       if (isset($argv['mywidth'])) {
                $width = $argv['mywidth'];
        } else {
                $width = 770;
       }       
       if (isset($argv['myheight'])) {
                $height = $argv['myheight'];
        } else {
                $height = 500;
       }
       if (isset($argv['myshift'])) {
                $shift = $argv['myshift'];
        } else {
                $shift = 30;
       }
       $output= '<iframe style="position:relative; right:'.$shift.'px;" name="anyweb" src="'.htmlspecialchars($input).'" width="'.$width.'" height="'.$height.'" frameborder="0">'.'</iframe>';                 
        return $output;

}

You can now use
<anyweb myshift="30">http://wikipedia.org</anyweb>
to shift it 30px from the right (i.e., on the left).