Module development guidelines for beginners

trupti

Joined: 2006-02-15
Posts: 9
Posted: Wed, 2006-02-15 17:45

Hey all,

Just set up G2 and pretty excited abt developing a new module..However I did not find any guidelines on how do I start writing a new module..I am new to PHP..more of a JAVA person..however am learning..read valiants doc abt views, controllers n templates..was very informative and helpful..however would be great if could get hold of a step-by step approach to a working example..for windows. I apologise if I missed out something of that sort which has already been posted.

Awaiting replies..

Thanks n Regards
~Trupti

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Wed, 2006-02-15 22:56

There isn't any good documentation yet for people wanting to write a new module. I think Bharat had a script that would start out a template for a module, but I learned by digging into existing modules and seeing how they work. You'll see that the PHP code for G2 looks more like Java than any PHP you have ever seen, and it should be pretty easy to pick up. What kind of module are you wanting to write?

 
trupti

Joined: 2006-02-15
Posts: 9
Posted: Thu, 2006-02-16 16:08

Well , I just wanted something to start with..very basic..maybe a simple form submit having a couple of text fields n a submit button like the New User Registration form. You are right, I shuldnt have trouble understanding the code...however I am having trouble understanding the flow..for eg..what all goes into a module..and how does it integrate and work together..like classes, templates , po n all?? Do I need to run a script or a batch file or anythin to reflect changes or what?? I was trying to run the perl script "update-all-translations.pl" located in the /lib/tools/po dir to reflect the text changes that I made and it throws the following exceptions-----

*****************************************************************************
modules/colorpack/po: The system cannot find the path specified.
FAIL!
themes/hybrid/po: The system cannot find the path specified.
FAIL!
modules/randomhighlight/po: The system cannot find the path specified.
FAIL!
modules/publishxp/po: The system cannot find the path specified.
......................
......................
.............................. n so on and so forth for all po directories.

******************************************************************************
I specified a log file to output make errors which just says" gmake: Command not found." Its obviously using make , I hope thats not a problem. I am using cygwin to run the script on a windows machine. I am not very familiar with perl and I am not quite understanding why its giving this exception?? I am sure once I understand how things actually work..coding wouldnt be a problem...:)

Any help would be greatly appreciated..Thanks

 
ckdake
ckdake's picture

Joined: 2004-02-18
Posts: 2258
Posted: Fri, 2006-02-17 00:12

I think i started to answer your update-all-translations question in another thread. That's not related to geting started on a module. You don't need to run make or anything in perl or anything like that.

If you want your module to be like the register module, take a look in there. You have to have a module.inc file so start figuring out what is going on in there.