Jump to content
MakeWebGames

Doesn't display message.


Ben Nash

Recommended Posts

When you click the Chop button it should go to a page saying You choped the down the normal log but it doesnt display the message.

Here are my files below:

woodcutting.tpl

 

{include file="header.tpl" TITLE="Wood Cutting"}

<h1>The Woods</h1>
<p>
<h2>Log Types</h2>
<table width="50%" border="1">
<tr>
<th>Log Type</th>
<th>Level Needed</th>
<th>-</th>
</tr>
<tr>
<td>Normal Log</td>
<td>1</td>
<td><form action='index.php?mod=WoodCutting&act=log1' method='POST'><input type='submit' name='choplog1' value='Chop' /></form></td>
</tr>
</table>
</p>
{include file="footer.tpl"}

 

cuttinglog1.tpl

 

{include file="header.tpl" TITLE="Cutting Log"}
<h1>Cutting Normal Log</h1>
{include file="footer.tpl"}

 

modules/WoodCutting/index.php

 

<?php
//This file cannot be viewed, it must be included
defined('IN_EZRPG') or exit;


class Module_WoodCutting extends Base_Module
{

   public function start()
   {
       //Require the user to be logged in
       requireLogin();



      if (isset($_GET['act']))
       {
           switch($_GET['act'])
           {
           case 'log1':
          $this->log1();
               break;

           default:
               $this->home();
               break;
           }
       }
       else
       {
           $this->home();

       }
       }




	private function home() {
      $this->tpl->display('woodcutting.tpl');
       }

    	       private function log1() {
    	        $this->tpl->display('cuttinglog1.tpl');
    	       $msg = 'You chopped the normal log down.';








       }


   }

?>

 

Thank you.

Edited by Ben Nash
Link to comment
Share on other sites

Module:

private function log1() {    $this->tpl->assign('msg', 'You chopped the normal log down.');
   $this->tpl->display('cuttinglog1.tpl');
}

 

Tpl:

{include file="header.tpl" TITLE="Wood Cutting"} 
<h1>The Woods</h1>
{if isset($msg) }
   <p>{$msg}</p>
{/if}


<h2>Log Types</h2>
<table width="50%" border="1">
<tr>
<th>Log Type</th>
<th>Level Needed</th>
<th>-</th>
</tr>
<tr>
<td>Normal Log</td>
<td>1</td>
<td><form action='index.php?mod=WoodCutting&act=log1' method='POST'><input type='submit' name='choplog1' value='Chop' /></form></td>
</tr>
</table>
{include file="footer.tpl"}

 

Ref: http://www.smarty.net/docsv2/en/api.assign.tpl

Edited by Spudinski
Link to comment
Share on other sites

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...