PhpTags/Transclude

From Test foxway
Jump to: navigation, search

This page demonstrates the PhpTags extension

Bucket in the sand.svg You can play it in the namespace sandbox (editing is allowed for anonymous users there)


Source of this page:

<phptag>
echo "Hello\n\n";
echo transclude( "Dump", ['1', '22', '333', '4444', 'test'=>'TEST'] );
echo "\n\nBye";
</phptag>

<phptag>
echo "\n----\n";
echo "Hello\n\n";
$foo = transclude( false, [], '{{Dump|1|22|333|4444|test=TEST}}' );
echo "\n\nBye";
echo $foo;
</phptag>

Source of Template:Dump:

<noinclude>
This is the Dump template
</noinclude>
<phptag>
foreach ( $argv as $key => $value ) {
	echo "\n* $key => $value";
}
echo "\n";
</phptag>

Result:

Hello


  • 0 => Template:Dump
  • 1 => 1
  • 2 => 22
  • 3 => 333
  • 4 => 4444
  • test => TEST


Bye



Hello


Bye

  • 0 => Template:Dump
  • 1 => 1
  • 2 => 22
  • 3 => 333
  • 4 => 4444
  • test => TEST