DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • May 22, 2013, 02:28:28 AM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: Help with my first module!!!  (Read 834 times)
0 Members and 1 Guest are viewing this topic.
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« on: September 19, 2009, 09:42:42 AM »

Im creating my first module for my site,and am stuck on the "Function_run" i just dont get what goes there...

Here it is so far...
Code:
<?php
function pokemart_getmoduleinfo(){
         
$info = array(
                  
"name"=>"Poke Mart",
                  
"version"=>"1.1",
                  
"author"=>"Oak",
                  
"category"=>"Village",
                  
"download"=>"Not Pulicily Released",
           );
           return 
$info;
}

function 
pokemart_install(){
       
module_addhook("village");
       return 
true;
}

function 
pokemart_uninstall(){
        return 
true;
}

function 
pokemart_dohook($hookname,$args){
        global 
$session;
       switch(
$hookname){
       case 
"village":
       break
   }
   return 
$args;
}

function 
pokemart_run(){
 
   
}
?>
Logged
KaosKaizer
Mod God
*****
Offline Offline

Posts: 1000


Love bites, but so do I!


View Profile
« Reply #1 on: September 19, 2009, 10:39:51 AM »

Well, first you have to finish your dohook Tongue
The village case is somewhat ... empty ...
Code:
case "village":
break;

Try doing and addnav in the village case.
addnav("Poke Mart","runmodule.php?module=pokemart&op=whatever");

Then, you put the run in there, IE, what the page does and says to the user/server.
So, you would start off something like this:
Code:
function pokemart_run(){
global $session;
page_header("Poke Mart");
$op = httpget('op');
if ($op == "whatever"){
//include code here
}
page_footer();
}

and so on..You can look at other modules for examples at how to do it right or how to include multiple pages.
Logged

My Mods
Like to read? "Like" my page. Smiley
For reasons I'd prefer not to explain, I will not be active until further notice. I will not make any posts and I will ignore all PMs.
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #2 on: September 19, 2009, 10:56:56 AM »

thats great thanks alot...
Logged
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #3 on: September 19, 2009, 11:06:15 AM »

Could you expalin what the $op command means please.
Logged
Edward
Mod God
*****
Offline Offline

Posts: 592

Now... Who's a Llama?


View Profile
« Reply #4 on: September 19, 2009, 11:15:18 AM »

Could you expalin what the $op command means please.


It's a httpget, meaning, if there is an op in the url, whatever follows after an =, is taken from it. Smiley.
Or that's my understanding of it, partially by the php.net bit.

Sidenote.
A pokémon game... how will the trainer's pokémon be put - companions?

Logged
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #5 on: September 19, 2009, 11:25:09 AM »

Thanks...

Not sue yet about the trainers with there pokemon,ill leave that to when i get it...
Logged
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #6 on: September 19, 2009, 11:56:19 AM »

When i upload this it just gives me an error when i go to manage module..

Code:
<?php
function pokemart_getmoduleinfo(){
         
$info = array(
                  
"name"=>"Poke Mart",
                  
"version"=>"1.1",
                  
"author"=>"Oak",
                  
"category"=>"Village",
                  
"download"=>"Not Pulicily Released",
           );
           return 
$info;
}

function 
pokemart_install(){
       
module_addhook("village");
       return 
true;
}

function 
pokemart_uninstall(){
        return 
true;
}

function 
pokemart_dohook($hookname,$args){
        global 
$session;
       switch(
$hookname){
       case 
"village":
       
addnav("Poke Mart","runmodule.php?module=pokemart&op=whatever");
       break
   }
   return 
$args;
}

 function 
pokemart_run(){
global 
$session;
page_header("Poke Mart");
$op httpget('op');
if (
$op == "whatever"){
//include code here
}
page_footer();
   
}
?>
« Last Edit: September 19, 2009, 11:59:33 AM by shudnyy » Logged
KaosKaizer
Mod God
*****
Offline Offline

Posts: 1000


Love bites, but so do I!


View Profile
« Reply #7 on: September 19, 2009, 12:05:19 PM »

You forgot a semicolon( ; ) after 'break' in your do_hook.
Logged

My Mods
Like to read? "Like" my page. Smiley
For reasons I'd prefer not to explain, I will not be active until further notice. I will not make any posts and I will ignore all PMs.
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #8 on: September 19, 2009, 12:07:05 PM »

Oh sorry lol..

Thanks Kaizer..
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
21 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search