Oct 14, 2008 | 06:35 AM  
Welcome

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.

 • •  Control Panel - Register - Login  • • 
Current Stable MDPro Lite 1.0821 Download
  Forum FAQForum FAQ   SearchSearch  UsergroupsUsergroups  PreferencesPreferences  Options forumOptions forum  Watched TopicsWatched Topics  Watched ForumsWatched Forums
Latest forum posts Latest forum posts  Log in to check your private messages Log in to check your private messages    Log inLog in 
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
JasonGW
MD user level 1
MD user level 1


Joined: Oct 05, 2003
Posts: 20

Member
Post  Posted: June 24, 2005 - 03:28 AM Reply with quote Back to top
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 Smile 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.

Thanks!

Jason
View user's profile Visit poster's website Yahoo Messenger MSN Messenger
PeteBest
MD user level 5
MD user level 5


Joined: Oct 06, 2003
Posts: 4845

bannato
Post  Posted: June 24, 2005 - 03:30 AM Reply with quote Back to top

http://docs.maxdev.com/devdocs/

Aside from that get on Amazon.com and buy yourself a few php books

_________________
Retired from official MAXdev duties
View user's profile
JasonGW
MD user level 1
MD user level 1


Joined: Oct 05, 2003
Posts: 20

bannato
Post  Posted: June 24, 2005 - 03:37 AM Reply with quote Back to top

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 Smile

Jason
View user's profile Visit poster's website Yahoo Messenger MSN Messenger
PeteBest
MD user level 5
MD user level 5


Joined: Oct 06, 2003
Posts: 4845

bannato
Post  Posted: June 24, 2005 - 03:46 AM Reply with quote Back to top

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 Wink

_________________
Retired from official MAXdev duties
View user's profile
JasonGW
MD user level 1
MD user level 1


Joined: Oct 05, 2003
Posts: 20

bannato
Post  Posted: June 24, 2005 - 05:14 AM Reply with quote Back to top

"In theory, Marge, Communism works. in theory."

(Little Simpsons Quote there) Smile
View user's profile Visit poster's website Yahoo Messenger MSN Messenger
data_art
MD user level 5
MD user level 5


Joined: June 27, 2004
Posts: 58

bannato
Post  Posted: Aug 26, 2005 - 11:11 PM Reply with quote Back to top
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.
View user's profile Visit poster's website Yahoo Messenger
PeteBest
MD user level 5
MD user level 5


Joined: Oct 06, 2003
Posts: 4845

bannato
Post  Posted: Aug 27, 2005 - 12:02 AM Reply with quote Back to top

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
View user's profile
data_art
MD user level 5
MD user level 5


Joined: June 27, 2004
Posts: 58

bannato
Post  Posted: Aug 27, 2005 - 03:26 AM Reply with quote Back to top
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.
View user's profile Visit poster's website Yahoo Messenger
Duster
English Doc Manager
English Doc Manager


Joined: June 22, 2004
Posts: 792
Location: Miami Beach, Florida, USA

Post  Posted: Aug 27, 2005 - 05:48 AM Reply with quote Back to top

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
View user's profile
data_art
MD user level 5
MD user level 5


Joined: June 27, 2004
Posts: 58

bannato
Post  Posted: Aug 27, 2005 - 06:06 AM Reply with quote Back to top
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.
View user's profile Visit poster's website Yahoo Messenger
PeteBest
MD user level 5
MD user level 5


Joined: Oct 06, 2003
Posts: 4845

bannato
Post  Posted: Aug 27, 2005 - 07:48 AM Reply with quote Back to top

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
View user's profile
dmiranda
MD Staff
MD Staff


Joined: Dec 07, 2003
Posts: 770
Location: Kenya
bannato
Post  Posted: Aug 27, 2005 - 10:20 AM Reply with quote Back to top

For PNHTML, try

in the first line of the funciton
$output = new pnHTML();

In the last line
return $output->GetOutput();}

_________________
We know what you are missing
http://www.hmtraveller.com
View user's profile Visit poster's website
data_art
MD user level 5
MD user level 5


Joined: June 27, 2004
Posts: 58

bannato
Post  Posted: Aug 30, 2005 - 11:11 PM Reply with quote Back to top
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();

// $output->SetOutputMode(_PNH_RETURNOUTPUT);

$output->SetInputMode(_PNH_VERBATIMINPUT);
// $output->TableStart(_TEMPLATE);
$output->Text("Gribbit");
$output->Text("Super Gribbit");
$output->Text("<html><table border=4 bgcolor=red><tr><td>Hello</td></tr></table></html>");
$output->SetInputMode(_PNH_PARSEINPUT);
// $output->TableEnd();

// $output->SetOutputMode(_PNH_KEEPOUTPUT);

return $output->GetOutput();
}

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.
View user's profile Visit poster's website Yahoo Messenger
data_art
MD user level 5
MD user level 5


Joined: June 27, 2004
Posts: 58

bannato
Post  Posted: Sep 10, 2005 - 02:12 AM Reply with quote Back to top
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.
View user's profile Visit poster's website Yahoo Messenger
Lobos
MD user level 3
MD user level 3


Joined: Sep 22, 2003
Posts: 37

bannato
Post  Posted: Sep 10, 2005 - 04:28 PM Reply with quote Back to top

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!

-Lobos
View user's profile
Display posts from previous:     
Jump to:  
All times are GMT + 13 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by MDForum 2.0.8© 2003-2007 MAXdev Team
Credits