MTA Mappingu konverteris. (XML => Lua) function converterWindow()
{
echo '<div class="container-fluid span9 well">';
if (isset($_POST['passXML']))
{
echo '<a href="http://mta.exs.lv/converter/" class="btn btn-block btn-info">Atpakaļ</a>';
echo '<textarea class="input-block-level" rows="20">';
$xml = simplexml_load_string($_POST['xml']);
for ($i = 0; $xml->object[$i]; $i++)
{
$create = $xml->object[$i]->attributes();
echo 'createObject('.$create->model.', '.$create->posX.', '.$create->posY.', '.$create->posZ.', '.$create->rotX.', '.$create->rotY.', '.$create->rotZ.')
';
}
for ($i = 0; $xml->removeWorldObject[$i]; $i++)
{
$remove = $xml->removeWorldObject[$i]->attributes();
echo 'removeWorldModel('.$remove->model.', '.$remove->radius.', '.$remove->posX.', '.$remove->posY.', '.$remove->posZ.')
';
}
echo '</textarea>';
}
else
{
echo '<form method="post">';
echo '<textarea rows="20" name="xml" class="input-block-level"></textarea>';
echo '<button name="passXML" class="btn btn-block btn-info">Konvertēt!</button>';
echo '</form>';
}
echo '</div>';
}
Ja nu kādam noder. Slinkums vākt nost bootstrap'a klases.
Paldies @mad par to, ka parādija simplexml(), citādi es būtu čakarējies ar regex'iem. :shura:
SJohnson miniblogs
- 0
SJohnson 05.10.2013. 01:19
Ielogojies vai izveido profilu, lai komentētu!