Don't have an account yet? You can create one, it is free, just click here
as a registered user you have some advantages like free downloads, comments and posting on our forums, depending upon this site's configuration and options.
Post subject: Is there some documentation or tutorial on module building?
Because boy oh boy is the mod_template not really helpful for some of us development n00bs It'd be very handy to have some idea what each of the files does and maybe a listing of usable parameters/hooks into the system.
Aside from that get on Amazon.com and buy yourself a few php books
_________________ Retired from official MAXdev duties
JasonGW MD user level 1
Joined: Oct 05, 2003
Posts: 20
bannato
 Posted:
June 24, 2005 - 03:37 AM
Thanks, I will check out that site. I've got plenty of PHP books; php isn't my problem, it's just understanding all the complexity of a whole system such as this. I mean I love MD, used it since it first came out, but never really had the need to build a module before. Now I do
Jason
PeteBest MD user level 5
Joined: Oct 06, 2003
Posts: 4845
bannato
 Posted:
June 24, 2005 - 03:46 AM
Once TiMax gets a bit more time he's going to be setting up a mailing list for 3rd party developers, so the MD-Pro devs can share their knowledge and help the community. At least, that's the theory
_________________ Retired from official MAXdev duties
JasonGW MD user level 1
Joined: Oct 05, 2003
Posts: 20
bannato
 Posted:
June 24, 2005 - 05:14 AM
"In theory, Marge, Communism works. in theory."
(Little Simpsons Quote there)
data_art MD user level 5
Joined: June 27, 2004
Posts: 58
bannato
 Posted:
Aug 26, 2005 - 11:11 PM
Post subject: Jason, I'm with YOU.
Who knows how the hell this module API works? The functions are like manifestations of the spirit world - they seem to be there, but I can't directly influence them.
PeteBest MD user level 5
Joined: Oct 06, 2003
Posts: 4845
bannato
 Posted:
Aug 27, 2005 - 12:02 AM
If you let us know which function you're having trouble with we can assist. If you just have no clue how it all works you probably need more coding experience before attempting to create a module
_________________ Retired from official MAXdev duties
data_art MD user level 5
Joined: June 27, 2004
Posts: 58
bannato
 Posted:
Aug 27, 2005 - 03:26 AM
Post subject: Custom functions
Hey Pete
Sorry about the rant; you’re usually extremely helpful. Tell me, is there a way that I can circumvent using the Postnuke API altogether and just make my own functions? Whenever I create a simple function in the admin.php or user.php files, nothing ever shows up at all on my output.
For example:
function basic_function() {
echo “This is a basic function”;
} basic_function();
Nothing happens.
Duster English Doc Manager
Joined: June 22, 2004
Posts: 792
Location: Miami Beach, Florida, USA
 Posted:
Aug 27, 2005 - 05:48 AM
Circumventing the API is not a good idea. Both PN and MD-Pro are moving towards all modules being API compliant. A programmer could probably tell you the advantages of a module being API compliant. I only know that it makes a diffference in sharing tables on multi-site installations.
Last edited by Duster on Aug 27, 2005 - 06:49 AM; edited 1 time in total
data_art MD user level 5
Joined: June 27, 2004
Posts: 58
bannato
 Posted:
Aug 27, 2005 - 06:06 AM
Post subject: Duster! Help me out here man...
Mastering the API might be a wise move in general. However, I'm getting zero output. For me, the API would be putting the cart before the horse.
PeteBest MD user level 5
Joined: Oct 06, 2003
Posts: 4845
bannato
 Posted:
Aug 27, 2005 - 07:48 AM
data_art: I think you're getting the API and pnHTML a bit mixed up. The API is just a set of commonly used functions, for example we have a function to clean up characters before they're submitted to the database etc etc. Nothing big or confusing about it really, each function is documented in our docs area that was linked to earlier. If you really wanted you could add your function into pnAPI.php in the includes directory, but if you're only using it once there is little point in doing that.
The code you used is valid and correct, the only thing that would make the output not show is if you've placed it in the wrong place within the module
_________________ Retired from official MAXdev duties
dmiranda MD Staff
Joined: Dec 07, 2003
Posts: 764
Location: Kenya
bannato
 Posted:
Aug 27, 2005 - 10:20 AM
For PNHTML, try
in the first line of the funciton
$output = new pnHTML();
Post subject: Current Progress on the Module Template
In the module folder there are eight files:
index.html
pnadmin.php
pnadminapi.php
pninit.php
pntables.php
pnuser.php
pnuserapi.php
version.php
index.html is blank
pnadmin.php
This file appears to be the repository for the admin functions. (I speculate) Somewhere within this file is the code for getting the file to show up in the module named Modules as well as the code for displaying the corresponding icon in the administration icon grid. For certain, the admin code is in this file.
Along with my modifications up to this point, pnadmin is comprised of 896 lines. The first function one encounters is the "main" function. I have renamed it from whatever it was to "DougModule_admin_main". As a matter of fact, I did a search and replace of the generic module's name and replaced them all with DougModule. I renamed the generic module folder as well.
I created a user-defined function named NewbieFunction() and called it within DougModule_admin_main.
function NewbieFunction() {
$output =& new pnHTML();
Nothing happened. By luck, I changed line 80/81 from
// Return the output that has been generated by this function
return $output->GetOutput();
// return NewbieFunction();
to
// Return the output that has been generated by this function
// return $output->GetOutput();
return NewbieFunction();
and then NewbieFunction() worked!
Of course, I'd rather not replace DougModule_admin_main() with NewbieFunction(). I would lose all of the functional razzle-dazzle.
My next goal is to get NewbieFunction to execute some functions instead of only outputting text.
data_art MD user level 5
Joined: June 27, 2004
Posts: 58
bannato
 Posted:
Sep 10, 2005 - 02:12 AM
Post subject: Current Status of Module Development
Whew! There are 873 lines of code in admin.php. It took a few days to comment-out each line individually; now I will begin the task of uncommenting line by line in order to examine each function.
Sidenote: I tried to enlist the help of coders at Rentacoder.com. None of the developers there offered a bid to help. It seems that (at the moment) more coders are familiar with Postnuke coding...I'm sure MD-Pro will become more well known in time.
Lobos MD user level 3
Joined: Sep 22, 2003
Posts: 37
bannato
 Posted:
Sep 10, 2005 - 04:28 PM
Hey in a few days I will be releasing an example module that will have you up and coding pnapi compliant modules in no time!