mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
Twig updates
Moved non-global functions from twig back into PHP.
This commit is contained in:
parent
8c06bd1738
commit
5547ccffd6
@ -13,10 +13,19 @@ defined('MYAAC') or die('Direct access not allowed!');
|
|||||||
$title = "Creatures";
|
$title = "Creatures";
|
||||||
|
|
||||||
if (empty($_REQUEST['creature'])) {
|
if (empty($_REQUEST['creature'])) {
|
||||||
$creatures = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 '.(empty($_REQUEST['boss']) ? '': 'AND `rewardboss` = 1').' ORDER BY name asc');
|
$preview = config('creature_images_preview');
|
||||||
|
$creatures = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 '.(empty($_REQUEST['boss']) ? '': 'AND `rewardboss` = 1').' ORDER BY name asc')->fetchAll();
|
||||||
|
|
||||||
|
if ($preview) {
|
||||||
|
foreach($creatures as $key => &$creature)
|
||||||
|
{
|
||||||
|
$creature['img_link'] = getCreatureImgPath($creature['name']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$twig->display('creatures.html.twig', array(
|
$twig->display('creatures.html.twig', array(
|
||||||
'creatures' => $creatures->fetchAll(),
|
'creatures' => $creatures,
|
||||||
'preview' => config('creature_images_preview'),
|
'preview' => $preview
|
||||||
));
|
));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
<div class="creatureImages">
|
<div class="creatureImages">
|
||||||
<a href="{{ getMonsterLink(creature.name, false)|raw }}">
|
<a href="{{ getMonsterLink(creature.name, false)|raw }}">
|
||||||
<div class="creature_img " style="background-image: url({{ creature.img_link }}"></div>
|
<div class="creature_img " style="background-image: url({{ creature.img_link }}"></div>
|
||||||
<img class=" {{ (creature.rewardboss ? 'creatureBoss' : '') }}" src="{{ getCreatureImgPath(creature.name) }}" border="0"/>
|
<img class=" {{ (creature.rewardboss ? 'creatureBoss' : '') }}" src="{{ creature.img_link }}" border="0"/>
|
||||||
</a>
|
</a>
|
||||||
<div>{{ creature.name }}</div>
|
<div>{{ creature.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,11 +24,6 @@ $function = new TwigFunction('getStyle', function ($i) {
|
|||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('getCreatureImgPath', function ($i) {
|
|
||||||
return getCreatureImgPath($i);
|
|
||||||
});
|
|
||||||
$twig->addFunction($function);
|
|
||||||
|
|
||||||
$function = new TwigFunction('getLink', function ($s) {
|
$function = new TwigFunction('getLink', function ($s) {
|
||||||
return getLink($s);
|
return getLink($s);
|
||||||
});
|
});
|
||||||
@ -55,19 +50,10 @@ $function = new TwigFunction('getGuildLink', function ($s, $p) {
|
|||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('truncate', function ($s, $n) {
|
$function = new TwigFunction('truncate', function ($s, $n) {
|
||||||
return truncate($s, $n);
|
return truncate($s, $n);
|
||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('getChangelogType', function ($n) {
|
|
||||||
return getChangelogType($n);
|
|
||||||
});
|
|
||||||
$twig->addFunction($function);
|
|
||||||
|
|
||||||
$function = new TwigFunction('getChangelogWhere', function ($n) {
|
|
||||||
return getChangelogWhere($n);
|
|
||||||
});
|
|
||||||
$twig->addFunction($function);
|
|
||||||
$function = new TwigFunction('hook', function ($hook) {
|
$function = new TwigFunction('hook', function ($hook) {
|
||||||
global $hooks;
|
global $hooks;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user