By ghopper on
I wanna study how to develop modules , but I meet a few basic problems and I can't understand them.
where can I ask them?
I wanna study how to develop modules , but I meet a few basic problems and I can't understand them.
where can I ask them?
Comments
Guidebooks
Have you read through the Contributors guide and specifically the Module developer's guide and still facing issues? If so, you could post the problems you are having here or to the support mailing list and somebody should be able to help out more.
Module development
Good place to start is: http://drupal.org/node/508
Good luck
And
http://api.drupal.org
--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Or a little more helpful...
Or a little more helpful... if you need to ask a question that you can't find the answer to... just use the module development support forums here at drupal.org! You can always take it to the Drupal dojo, too. (http://groups.drupal.org/drupal-dojo) There are generally enough dev's around here to answer questions.
----------------------
Current Drupal project: http://www.ubercart.org
thank you a lot. I have read
thank you a lot.
I have read the Module developer's guide and I finished the onthisdate module, but I can't understand other modules.
If I want to insert a record into database, I don't know how to do it.
The biggest problem is there are too many bisic problems I meet .
such as $access = user_access('administer comments');
how many kinds of user_access parameters? where can I find them all?
'administer comments','administer site configuration' .....
hook_menu($may_cache), how can I know the parameter($may_cache)'s value is true or false?
Quick Answers:
To insert a record into the database, you just use the function db_query("...") and put a normal SQL query in the quotes. Something like so:
There's a few things to keep in mind... always put table names inside curly braces { } so Drupal can prefix them if necessary. Read more about the print_f-ish syntax of db_query() here and here. The idea is using this will escape input appropriately to prevent SQL injection attacks. (People hacking your module to screw up the database or get inappropriate information.)
user_access "parameters" are actually defined in each individual module for that module. The hook function hook_perm() returns an array of access permissions. These are what you use in hook_menu() and elsewhere to determine a user's role based permissions. If you go to access control (admin/access in 4.7, admin/user/access in 5.0) you can see a list of all the module defined permissions.
Lastly, $may_cache is just that... it tells the module to return data that is cacheable if TRUE and items that aren't if FALSE (any dynamic URL that relies on a node ID or something similar is not cacheable... like node/34/edit). So, if there is no menu cache and a user tries to access your site, Drupal will first invoke hook_menu() with $may_cache == TRUE and then $may_cache == FALSE. If there is already a menu cache, subsequent page loads will only invoke hook_menu() with $may_cache == FALSE.
----------------------
Current Drupal project: http://www.ubercart.org
Very helpful! Just wondering
Very helpful! Just wondering where can I find handbook/docs on this $may_cache thing, I searched both d.d.o and api.drupal.org and your reply seems to be all I can find....
page_example.module
Have you seen the documented hook_menu example at http://api.drupal.org/api/HEAD/function/page_example_menu which is part of the page_example module to demonstrate how things work?
Interesting... I've never
Interesting... I've never seen that one. hehe There's a bit of information in the comments above the if ($may_cache), but I'd say it's still a little ambiguous. The name of the variable itself I guess is supposed to supplement that.
----------------------
Current Drupal project: http://www.ubercart.org