Reputation:
i am new to drupal, currently learning drupal 7.
i am referring book for drupal 7
i was trying to create my first custom module
in the book it was mention that you can create module in one of the following directory
1) /sites/all/modules
2) /sites/default/modules
name of my module is first
i have created my module in /sites/default/modules/first
in this directories there are two file
1)first.info
2)first.module
content of first .info files are
;$Id$
name = First
description = A first module.
package = Drupal 7 Development
core = 7.x
files[] = first.module
;dependencies[] = autoload
;php = 5.4
content of fisrt.module files are
<?php
// $Id$
/**
* @file
* A module exemplifying Drupal coding practices and APIs.
*
* This module provides a block that lists all of the
* installed modules. It illustrates coding standards,
* practices, and API use for Drupal 7.
*/
/**
* Implements hook_help().
*/
function first_help($path, $arg) {
if ($path == 'admin/help#first') {
return t('A demonstration module.');
}
}
?>
when i try to check list of modules i am not able to see module that i created
i have tired clearing cache and check still not showing
can anybody tell me where i am wrong.
Thanks in advance
Upvotes: 0
Views: 3462
Reputation: 19
I solved this problems by starting my .info file with
name = First
and make my file encode:
UTF-8 without BOM
you can find it easy when using Notpade++
Upvotes: 1
Reputation: 1
Try taking out the ?> that marks the end of the php code.This is done to prevent white space to breakup HTTP headers.
Upvotes: 0
Reputation: 11
function test_example_help($path, $arg){
switch ($path) {
case "admin/help#test_example":
return '<p>' . t("test module to see how it works and shows") . '</p>';
break;
}
try the following example using a switch statement to see whether it works
Upvotes: 0
Reputation: 785
Module Location
Most people choose to put modules in the /sites/all/modules
or /sites/domain.com/modules
folders (not sites/default...
). For most common Drupal installations you should place it in sites/all/modules
.
Info File
Only Name, Description and Core are required in your info file. Start by removing everything except those values.
name = First
description = A first module.
core = 7.x
See Writing module .info files (Drupal 7.x) for more information.
Some notes:
.module
file in the "files" Property.Upvotes: 3