Jump to content
MakeWebGames

Recommended Posts

Posted

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

image.thumb.png.69421dd0efdd4cd45478d4e9d1d094aa.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...