user1414232
user1414232

Reputation:

drupal 7 newly created custom module does not showing up in module list

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

Answers (4)

Bakri A. Altaif
Bakri A. Altaif

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

ganx
ganx

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

star
star

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

Adam Balsam
Adam Balsam

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:

  • The "package" Property "should only be used by large multi-module packages"
  • You don't need to declare your module's .module file in the "files" Property.
  • Remove the commented out lines for now. If your module really requires PHP 5.4, you can add that back in later after you're done troubleshooting.

Upvotes: 3

Related Questions