• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC PHP on Twigs ?! Code.

luhfe

New Member
Joined
Apr 26, 2018
Messages
48
Reaction score
2
Good day everyone....its nice day.
<?PHP
$monsterquery = $SQL->query("SELECT boostname FROM boosted_creature")->fetch();
$monstername = $monsterquery["boostname"];
?>

<img src="https://static.tibia.com/images/global/header/monsters/<?PHP echo strtolower(preg_replace('/\s*/', '',$monstername)); ?>.gif" alt="Monster of the Day" title="Today's boosted creature: <?PHP echo ucwords(strtolower(trim($monstername))); ?>" style="
height: auto;
width: auto;
position: absolute;
right: 0px;
bottom: 0px;
z-index: 106;">
</div>

Can someone change its to put in a Twig file ?? I DONT KNOW ANY about codes of twigs, rly appreciate.... ty all.
 
Solution
Let's start with, why would you like to put this code in Twig if it works in PHP just good? =)

ok, anyways.

Your code in Twig would look like this:
Code:
<img src="https://static.tibia.com/images/global/header/monsters/{{ monsterFileName }}.gif" alt="Monster of the Day" title="Today's boosted creature: {{ monsterName }}" style="
height: auto;
width: auto;
position: absolute;
right: 0px;
bottom: 0px;
z-index: 106;">
</div>

Then somewhere in your PHP code you need to include that Twig file:
PHP:
<?php
$monsterquery = $SQL->query("SELECT boostname FROM boosted_creature")->fetch();
$monstername = $monsterquery["boostname"];

$twig->display('your_file.html.twig', [
   'monsterFileName' => strtolower(preg_replace('/\s*/'...
Let's start with, why would you like to put this code in Twig if it works in PHP just good? =)

ok, anyways.

Your code in Twig would look like this:
Code:
<img src="https://static.tibia.com/images/global/header/monsters/{{ monsterFileName }}.gif" alt="Monster of the Day" title="Today's boosted creature: {{ monsterName }}" style="
height: auto;
width: auto;
position: absolute;
right: 0px;
bottom: 0px;
z-index: 106;">
</div>

Then somewhere in your PHP code you need to include that Twig file:
PHP:
<?php
$monsterquery = $SQL->query("SELECT boostname FROM boosted_creature")->fetch();
$monstername = $monsterquery["boostname"];

$twig->display('your_file.html.twig', [
   'monsterFileName' => strtolower(preg_replace('/\s*/', '',$monstername)),
   'monsterName' => ucwords(strtolower(trim($monstername)))
]);
 
Solution
Edit : Remember, at use that code and try see in host pc maybe dont show at all, but with using external link works fine.
Edit 2 : @slaw maybe you can help me more set ~Put your link here~ with the code !? ty anyway <3


First of all sorry for delong and ty dude for all you hard work and sharing with community !!!
i dont say too much and you help me fine... so lets share what i'm doing...

i'm using that :

And change to that :

in Creatures.html.twig on the top, press 'enter' ... Add in first line :

<div class="TableContainer">
<div class="CaptionContainer">
<div class="CaptionInnerContainer">
<span class="CaptionEdgeLeftTop" style="background-image:url(https://static.tibia.com/images/global/content/box-frame-edge.gif);"></span>
<span class="CaptionEdgeRightTop" style="background-image:url(https://static.tibia.com/images/global/content/box-frame-edge.gif);"></span>
<span class="CaptionBorderTop" style="background-image:url(https://static.tibia.com/images/global/content/table-headline-border.gif);"></span>
<span class="CaptionVerticalLeft" style="background-image:url(https://static.tibia.com/images/global/content/box-frame-vertical.gif);"></span>
<div class="Text">Boosted Creature</div>
<span class="CaptionVerticalRight" style="background-image:url(https://static.tibia.com/images/global/content/box-frame-vertical.gif);"></span>
<span class="CaptionBorderBottom" style="background-image:url(https://static.tibia.com/images/global/content/table-headline-border.gif);"></span>
<span class="CaptionEdgeLeftBottom" style="background-image:url(https://static.tibia.com/images/global/content/box-frame-edge.gif);"></span>
<span class="CaptionEdgeRightBottom" style="background-image:url(https://static.tibia.com/images/global/content/box-frame-edge.gif);"></span>
</div>
</div><table class="Table1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div class="InnerTableContainer">
<p><img src="https://static.tibia.com/images/global/header/monsters/{{ monsterFileName }}.gif" style="float:right">Todays boosted creature: <a href="Put your link here">{{ monsterNam }}</a></p>
<p>To avoid that always the same creature types are hunted and so eventually exterminated, the Tibian gods came up with the idea of the boosted creature.
Every day one creature is chosen which is particularly rewarding for this day. This way adventurers from all over Tibia should be attracted to hunt a larger variety of monsters.</p><p>Hunting a boosted creature is extra lucrative.
Boosted creatures contain more loot and yield more experience points. Moreover, they spawn at a faster rate.</p>
<p>Good hunting!</p>
<table style="width:100%;">
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>

Creatures.php


<?php
$title = 'Creatures';
$monsterquery = $SQL->query("SELECT boostname FROM boosted_creature")->fetch();
$monstername = $monsterquery["boostname"];

$race = isset($_GET['race']) ? $_GET['race'] : null;

if(empty($race)) {
echo $twig->render('creatures/creatures.html.twig', [
'monsterNam' => ($monstername) ,
'monsterFileName' => strtolower(preg_replace('/\s*/', '',$monstername))])
;
}
else {
if(!ctype_alnum($race)) {
echo 'Race contains illegal letters (a-z, A-Z and 0-9 only!).';
return;
}

$file = 'creatures/' . $race . '.html.twig';
if(file_exists(SYSTEM . 'templates/' . $file))
echo $twig->render($file);
}

Change Index.php Between

<div id="Footer"><?php echo template_footer(); ?><br/>Layout by CipSoft GmbH.</div>
</div>

and

<div id="Themeboxes">
<?php

To :

<div id="ThemeboxesColumn">
<?PHP
$monsterquery = $SQL->query("SELECT boostname FROM boosted_creature")->fetch();
$monstername = $monsterquery["boostname"];
?>
<div id="DeactivationContainerThemebox" onclick="DisableDeactivationContainer"></div>

<?php if ($config['info_bar_active2']){?>
<div id= "RightArtwork">
<div id="Monster" style="
height: 32px;
width: 32px;
position: absolute;
top: -62px;
left: 47px;">
<img src="https://static.tibia.com/images/global/header/monsters/<?PHP echo strtolower(preg_replace('/\s*/', '',$monstername)); ?>.gif" alt="Monster of the Day" title="Today's boosted creature: <?PHP echo ucwords(strtolower(trim($monstername))); ?>" style="
height: auto;
width: auto;
position: absolute;
right: 0px;
bottom: 0px;
z-index: 106;">
</div>
<img id="PedestalAndOnline" src="<?php echo $template_path; ?>/images/header/pedestal-and-online.gif" alt="Monster Pedestal">
</div>
<?php } else {?>
<div id="RightArtwork">
<div id="Monster" style="
height: 128px;
width: 128px;
position: absolute;
top: -158px;
left: -50px;">
<img src="https://static.tibia.com/images/global/header/monsters/<?PHP echo strtolower(preg_replace('/\s*/', '',$monstername)); ?>.gif" alt="Monster of the Day" title="Today's boosted creature: <?PHP echo ucwords(strtolower(trim($monstername))); ?>" style="
height: auto;
width: auto;
position: absolute;
right: 0px;
bottom: 0px;
z-index: 106;">
</div>
<img id="PedestalAndOnline" style="" src="<?php echo $template_path; ?>/images/header/pedestal-and-online.gif" alt="Monster Pedestal and Online">
</div><?php }?>

Will look like this :
 
Last edited:
Back
Top