TibiaWiki:Playground

The Playground
I dedicate this page for testing of the Wiki system. :) Feel free to try anything in here to see what it turns out like after being posted and saved.

-- Alreth ¦› Message me ¦› My contributions ¦› 17:06, 25 Nov 2004 (EST)

Some wiki code
links can not be written in HTML

Instead, use "" and "" for internal links Tibia will turn into Tibia

For external links, use "[" and "]" Tibia.com will turn into Tibia.com

Template tests
Testing the Buildings Template (cross your fingers):

testing something
--Lord de los Druidas 15:52, 14 Jun 2005 (EDT)

it works..... what i used is " " --Lord de los Druidas 15:54, 14 Jun 2005 (EDT)

Random
Kazordoon Library

Clickable Item Image
I think this will work well for making images link to the content page instead of the image page. It's not really pretty, and I have the height and width hard-coded, so it will only work on images that are 32x32 px (almost all item images). Just something that might be useful.

Scaled Images






parm formatting
Coolness, with version 1.6+, this is working.

TEST MESSAGE

Also, conditionals are working, too:

(Thanks to Rune Farmer for stealing those conditional templates from Wikipedia. They are very cool!)

--'' Caesar si viveret, ad remum dareris. '' --  Whitelaces &dagger;  Talk &dagger; -- 07:37, 6 April 2006 (CDT)

External Linking Test
These are some links to external websites to test the newly implemented javascript warning that erig added.


 * Tibianews
 * Visit Guam
 * Tibia.com
 * Dustbunny

Template Value retrieval test
hmmm.

I'll have to think about this a little bit.

Vial: Weight: Value:

Loot Value:

I think I figured this out, but it requires touching every item/creature/weapon/etc. page...again :(

Maybe I'll try some other stuff to see if there's a nother way to do this.

-- Whitelaces &dagger; Talk &dagger; &chi;&rho;&iota;&sigma;to&sigmaf; &alpha;n&epsilon;&sigma;t&eta;, &alpha;&lambda;&eta;&theta;&omega;&sigmaf; &alpha;n&epsilon;&sigma;t&eta; -- 10:41, 17 May 2006 (CDT)

If you're going to use this for the item template it won't realy work, since a blue robe is only 20oz. ;p

11:50, 11 June 2006 (UTC) <·>

Interwiki links
I saw on a wiki that the interwiki links stopped working.

I'll try it out overhere.

Wikimedia's hints for editors


 * Shows up as Wikimedia's hints for editors.

Weird :S

Signature test
1


 * →  &#171; Alreth &#187; ' &#171; Talk &#187; ' &#171; Contributions &#187;  ← 10:37, 11 January 2007 (PST)

2 3


 * →  &#171; Alreth &#187; ' &#171; Talk &#187; ' &#171; Contributions &#187;  ←

testing quizzie
config/LocalSettings.php to the parent directory.\n" ); } else { die( "You'll have to set the wiki up first!" ); } }

define( 'MEDIAWIKI', true );
 * 1) Valid web server entry point, enable includes.
 * 2) Please don't move this line to includes/Defines.php. This line essentially defines
 * 3) a valid entry point. If you put it in includes/Defines.php, then any script that includes
 * 4) it becomes an entry point, thereby defeating its purpose.

require_once( '../includes/Defines.php' ); require_once( '../LocalSettings.php' ); require_once( '../includes/Setup.php' );

wfProfileIn( 'main-misc-setup' ); OutputPage::setEncodings; # Not really used yet


 * 1) Debug statement for user levels
 * 2) print_r($wgUser);

if ( !is_null( $wgTitle ) && !$wgTitle->userCanRead ) { $wgOut->loginToUse; $wgOut->output; exit; }
 * 1) If the user is not logged in, the Namespace:title of the article must be in
 * 2) the Read array in order for the user to see it. (We have to check here to
 * 3) catch special pages etc. We check again in Article::view)

if ($wgUser->getID != 0) { $wgOut->setArticleFlag( false );

$wgTitle = Title::makeTitle( NS_SPECIAL, "Custom" );

$wgOut->setArticleRelated( false ); $wgOut->setRobotPolicy( "noindex,follow" );

//////////////////////////////////////////////////////////// // // xmlQuiz v1.1 - a simple quiz script // //////////////////////////////////////////////////////////// // // This script allows you to quiz users on any number of // questions and calculate the score. // // See readme.txt for more information. // // Author: Jon Thomas  // Last Modified: 12/18/2005 // // You may freely use, modify, and distribute this script. // ////////////////////////////////////////////////////////////

// // SET VARIABLES //

// name of XML file which contains your quiz data $xmlFile = "Quiz.xml";

// // GET QUIZ DATA //

// get XML data $data = implode("", file($xmlFile));

// create XML parser $parser = xml_parser_create;

// set parser options xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);

// parse XML data into arrays xml_parse_into_struct($parser, $data, $values, $tags);

// free parser xml_parser_free($parser);

// // STRUCTURE XML DATA INTO ARRAY //

// set counter variable for to-be-created questions array $questionNo = 0;

// cycle through parsed XML data to look for text and answer tags foreach ($values as $key=>$val) {

// a TITLE tag if ($val[tag] == "TITLE") { $wTitle = $val[value]; }

// save value to "questions" array if this is a TEXT tag if ($val[tag] == "TEXT") { $questions[$questionNo]['text'] = $val[value]; }

// save value to "questions" array if this is a CHOICES tag if ($val[tag] == "CHOICES") { $questions[$questionNo]['choices'] = $val[value]; }

// save value to "questions" array if this is an ANSWER tag if ($val[tag] == "ANSWER") { $questions[$questionNo]['answer'] = $val[value];

// increment question counter variable $questionNo++; } }

// // IMPORT POST VARIABLES //

import_request_variables("p", "post_");

// // PRINT FIRST QUESTION //

if (!isset($post_answers)) { $wtext .= "== Question 1 of ". ($questionNo). ": ==\n\n"; $wtext .= "'''". $questions[0]['text']. "'''\n"; $text .= "\n";

// split choices into "choices" array $choices = explode(", ", $questions[0]['choices']);

// print text field if there are no choices if (count($choices) == 1) { $text .= "\n"; }

// print radio fields if there are multiple choices else { // print a radio button for each choice for ($i = 0; $i < count($choices); $i++) { $text .= "<input type=\"radio\" name=\"answers[0]\" value=\"" . $choices[$i] . "\"> ". $choices[$i]. " \n"; }       }

$text .= "<input type=\"submit\" value=\"Next Question\">\n"; $text .= " \n"; }

// // PRINT NEXT QUESTION //

elseif (count($questions) > count($post_answers)) { // get number of next question $nextQuestion = count($post_answers);

// print question $wtext .= "== Question ". ($nextQuestion + 1). " of ". ($questionNo). " ==\n\n"; $wtext .= "'''". $questions[$nextQuestion]['text']. "'''\n"; $text .= "<form action=\"$PHP_SELF\" method=\"post\">\n";

// print answers to previous questions as hidden form fields for ($i = 0; $i < count($post_answers); $i++) { $text .= "<input type=\"hidden\" name=\"answers[$i]\" value=\"$post_answers[$i]\">\n"; }

// split choices into "choices" array $choices = explode(", ", $questions[$nextQuestion]['choices']);

// print text field if there are no choices if (count($choices) == 1) { $text .= "<input type=\"text\" name=\"answers[$nextQuestion]\" size=10>\n"; }

// print radio fields if there are multiple choices else { // print a radio button for each choice for ($i = 0; $i < count($choices); $i++) { $text .= "<input type=\"radio\" name=\"answers[$nextQuestion]\" value=\"" . $choices[$i] . "\">". $choices[$i]. " \n"; }       }

// print appropriate button label if (count($questions) == count($post_answers) + 1) { $text .= "<input type=\"submit\" value=\"Calculate Score\">\n"; }       else { $text .= "<input type=\"submit\" value=\"Next Question\">\n"; }

$text .= " \n"; }

// // CALCULATE AND PRINT SCORE //

else { // get number of questions $noQuestions = count($questions);

// get number of correct answers for ($i = 0; $i < $noQuestions; $i++) { // increment "noCorrectAnswers" variable if user has correct answer if ($questions[$i]['answer'] == $post_answers[$i]) { $noCorrectAnswers++; }       }

// calculate score $score = ($noCorrectAnswers / $noQuestions) * 100;

// round score to nearest whole precentage point $score = round($score);

// print score $wtext .= "\n== Quiz Results ==\n"; $wtext .= "=== You have scored $score% on this quiz.===\n";

if ($noCorrectAnswers == 0) { $text .= " You answered no questions correctly. <a href=". $PHP_SELF. ">Try again.</a> "; $text .= " Return to the <a href=\"/wiki/index.php\">Main Page</a> "; }

if ($noCorrectAnswers == 1) { $text .= " You answered 1 out of $noQuestions questions correctly. <a href=". $PHP_SELF. ">Try again.</a> "; $text .= " Return to the <a href=\"/wiki/index.php\">Main Page</a> "; }

if ($noCorrectAnswers > 1 && $noCorrectAnswers < $noQuestions) { $text .= " You answered $noCorrectAnswers out of $noQuestions questions correctly. <a href=". $PHP_SELF. ">Try again.</a> "; $text .= " Return to the <a href=\"/wiki/index.php\">Main Page</a> "; }

if ($noCorrectAnswers == $noQuestions) { $text .= " You answered all questions correctly! "; $text .= " Return to the <a href=\"/wiki/index.php\">Main Page</a> ";

}

for ($i = 0; $i < $noQuestions; $i++) {

// print question $wtext .= "== Question ". ($i + 1). " ==\n\n"; $wtext .= "'''". $questions[$i]['text']. "'''\n";

// split choices into "choices" array $choices = explode(", ", $questions[$i]['choices']);

// print radio fields if there are multiple choices

// print text field if there are no choices if (count($choices) == 1) { if ($post_answers[$i] == $questions[$i]['answer']) { $wtext .= "'''". $post_answers[$i]. " CORRECT''' \n"; } else { $wtext .= "'''". $post_answers[$i]. " INCORRECT''' \n"; }       } else {

$wtext .= "\n"; // print a radio button for each choice for ($x = 0; $x < count($choices); $x++) {

if (($questions[$i]['answer'] == $post_answers[$i]) && ($post_answers[$i] == $choices[$x])) { $wtext .= " ''' ". $choices[$x]. " CORRECT''' \n"; } else { if ($post_answers[$i] == $choices[$x]) { $wtext .= " ''' ". $choices[$x]. " INCORRECT''' \n"; } else { $wtext .= " ". $choices[$x]. " \n"; }

}       }                $wtext .= "</ul>\n"; } }

}

$wgOut->setPageTitle($wTitle);

$wgOut->addWikiText( " \n" ); $wgOut->addWikiText( $wtext ); $wgOut->addWikiText( " \n" );

$wgOut->addHTML( $text ); $wgOut->output; exit;

} else { $wgOut->loginToUse; $wgOut->output; exit; } ?> --  Farscaper  Talk   -- 07:02, 28 February 2007 (PST)

ok that dont work >.< erig dont has that extention --  Farscaper  Talk   -- 07:02, 28 February 2007 (PST) Bold text