11:17
hi zeropage
thanks for ur answer.... i have few doubts though...
how can i flush all drupal caches ?
do i need to logout and login again?
Administer -> Site Configuration -> Performance
there should be a button at the bottm labeled "Clear cached data"
yes, got it
and clicked on it... cleared
:)
you should install the 'Admin Menu' module for dupal, its great and has a lot of nice features drupal.org/project/admin_menu
now go to Administer > Site building > Blocks
11:22
yes, i went to blocks....
Depending on your implementation of hook_block() you should see your block in the list there
i dont have my block listed there...
This is my block code:
function hook_block($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks[0] = array(
'info' => t('Mymodule block #1 shows ...'),
'weight' => 0,
'status' => 1,
'region' => 'left',
);
// BLOCK_CACHE_PER_ROLE will be assumed for block 0.

$blocks[1] = array(
'info' => t('Mymodule block #2 describes ...'),
'cache' => BLOCK_CACHE_PER_ROLE | BLOCK_CACHE_PER_PAGE,
);

return $blocks;
}
else if ($op == 'configure' && $delta == 0) {
$form['items'] = array(
'#type' => 'select',
'#title' => t('Number of items'),
and you have created the mymodule_display_block_1() and mymodule_display_block_2() methods?
and my module name is: my_module
no..
i have not created them...
just replace them with 'content' => 'hello world 1' and 'content' => 'hello world 2' for the time being, just to get the block to work
11:29
yes... made those changes...
but i still dont see the block in the list
what name does it have ?
then clear your caches again and go to Administer > Site building > Blocks
their names should be 'Mymodule block #1 shows ...' and 'Mymodule block #2 describes ...'
still i dont see..
is there any problem with my code further
this is the last part of my file: my_module.module:
else if ($op == 'view') {
    switch ($delta) {
      case 0:
        // Your module will need to define this function to render the block.
        $block = array(
          'subject' => t('Title of block #1'),
          'content' => 'hello world1',
        );
        break;
      case 1:
        // Your module will need to define this function to render the block.
        $block = array(
          'subject' => t('Title of block #2'),
          'content' => 'hello world2',
        );
        break;
do you have access the php error log?
yes
i will check it
but in apache > error.log, i dont see any error
not apache error log, php error log
11:37
oh.. ok...
oh... thanks.... just a sec... please
sorry, i am struck at php error log
some more time it can take..
php error log is very helpful for debugging, it is worth getting to work :-)
In meantime, please accept my answer on your question :-)
sure...
accepted ur answer....
just a min..
i have enabled (removed semicolon) before the line "error_log" in php.ini but i found no file called php_error.log in its path
so i created an empty file there
and i have cleared the cache and tried refreshing my blocks page... still no errors logged in php_error.log
do i need to add a block through Add Block ?
11:55
No, if your hook_block() implementation is correct, the block should show up in the list
make sure that the logfile can be read and written to by the process that runs apache/php
yes, the log file can be read/written and it is inside the xampp/apache/logs
got it.... restarting my apache server...
still did not have any success...
this is all my code inside my_module.module:
<?php

function my_module_menu() {
  $items = array();
  $items['my_module/form'] = array(
    'title' => t('My form'),
    'page callback' => 'my_module_form',
    'access arguments' => array('access content'),
    'description' => t('Add a Training Program / Seminar'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function my_module_form() {
  return drupal_get_form('my_module_my_form');
}

function my_module_my_form($form_state) {

  $form['name']['name'] = array(
    '#type' => 'textfield',
please see full text
ah, your hook_block() implementation should be named my_module_block() :-D
oh... just a sec...
Got it
:)
i finally see a block with name: Mymodule block #1 shows ...
shall i move it to left sidebar ?
12:09
yeah, try that
you should se 'hello world..' in your page now
yes... saved it
now you will have to create the content in a proper way instead of 'hello world2' and 'hello world1'
yes... could see hello world under a title... could breathe finally..... :)
happy hacking! :-)
and ...
yes. i need to show the record names in the block
when the user clicks on a record name in the block, can i use ajax to show something in the block ?
12:13
yes you can, ajax combined with html generated in your hook_block() should enable you to finnish your module
gotta go now, have a nice weekend! :-)
Thanks a lot
You did a great help...