I have been looking at trying to get some work done for GL engine and have been running into some issues.
Let me explain what i was trying to do for a simple learning purpose i was trying to do a simple daily reward system.
1. User can goto page and click button
2. code runs then they are rewarded etc
I managed to figure out how to get the links on the side to show up but when i click on it just says cant be found.
My Steps:
1. Created a folder in "installed" named it daily
2. Inside this folder i have 3 files ( module.json , daily.tpl.php , daily.hooks.php)
Here's my files.
daily.tpl.php
<?php
class dailytemplate extends template {
public $dailygift = '
<div class="alert alert-warning">
You can claim up to 1 reward a day.
</div>
<div class="panel panel-default">
<div class="panel-heading">Would you like to open a gift?</div>
<div class="panel-body">
<div style="text-align:center;">
<a class="button-fixed-width btn btn-default" href="?page=dailyGifts&action=claim">Claim Gift</a>
</div>
</div>
</div>
';
}
?>
daily.hooks.php
<?php
new hook("userInformation", function ($user) {
global $page;
$time = $user->getTimer("daily");
if (($time-time()) > 0) {
$page->addToTemplate('daily_timer', $time);
} else {
$page->addToTemplate('daily_timer', 0);
}
});
new hook("actionMenu", function () {
return array(
"url" => "?page=daily",
"text" => "Daily Gift",
"sort" => 100
);
});
?>
When i try to access my page i get