Badge time.png   The Paragon Wiki Archive documents the state of City of Heroes/Villains as it existed on December 1, 2012.

User:Digitizer/Sandbox

From Paragon Wiki Archive
Revision as of 16:30, 27 April 2007 by Sir Giles (Talk | contribs)

Jump to: navigation, search

Introduction

Below is an example of an extension I wrote that will allow members to embed iFrames in the wiki pages. I mainly did this because I created a interactive map web page that I thought would be nice to add to the city zone pages. You can see an example of this on my SG's wiki site at Interactive Map. Mind you this map was done about I4 or so and and I should add shopes, new contacts, badge and plaque locations possible. I personally think that the urls that these iFrames point to should be stored on The Paragon Wiki.com site. The following php page could be set up to not output anything if the src url is not set to a location on paragonwiki.com pretty easily. Or we could limit it to a White List of sites.

Usage

<iframe src=url name="map" width="300" height="300" frameborder="0"><iframe>

Installation =

If interested all you need to do is create a file called iFrame.php copy the code below and save it in the file and then place it in the a folder on the wiki site at extensions/iFrame next you simply need to add require_once("$IP/extensions/iFrame/iFrame.php"); to the LocalSettings.php file in the root wiki directory.


<?php

$wgExtensionFunctions[] = 'wfiFrame';

$wgExtensionCredits['parserhook']['iFrame'] = array(
	'name' => 'iFrame',
	'author' => 'Robert Wagner',
	'url' => '',
	'description' => 'you to enbed a iFrame in a wiki page.',
);

function wfiFrame() {
	global $wgParser;
	$wgParser->setHook( 'iframe', 'RenderiFrame' );
}

function RenderiFrame($input, $argv)
{
	$output = "<IFRAME";

	$output .= isset($argv['src']) ? " src=\"" . $argv['src'] . "\"" : "";
	$output .= isset($argv['name']) ? " name=\"" . $argv['name'] . "\"" : "";
	$output .= isset($argv['scrolling']) ? " scrolling=\"" . $argv['scrolling'] . "\"" : "";
	$output .= isset($argv['width']) ? " width=\"" . $argv['width'] . "\"" : "";
	$output .= isset($argv['height']) ? " height=\"" . $argv['height'] . "\"" : "";
	$output .= isset($argv['frameborder']) ? " frameborder=\"" . $argv['frameborder'] . "\"" : " frameborder=\"0\"";

 	$output .= "></IFRAME>";

	return $output;
}
?>