知識社群登入
位置: Web Programming > 文件區 > drupal > module dev. demo
by 蘇德宙, 2011-05-09 14:41, 人氣(1259)
1. name:   onthisdate
2. folder: sites/all/modules/onthisdate
3. file:   onthisdate.module
by 蘇德宙, 2011-05-09 14:43, 人氣(1371)
 
name = Module name
description = A description of what your module does.
core = 6.x
by 蘇德宙, 2011-05-09 14:54, 人氣(1644)
 
function onthisdate_help($path, $arg) {
 
$output = ''//declare your output variable
 
switch ($path) {
    case
"admin/help#onthisdate":
     
$output = '<p>'t("Displays links to nodes created on this date") .'</p>';
      break;
  }
  return
$output;
}
by 蘇德宙, 2011-05-09 14:55, 人氣(1308)
 
function onthisdate_perm() {
  return array(
'access onthisdate content');
}
by 蘇德宙, 2011-05-09 15:01, 人氣(1801)
 
function onthisdate_block($op = 'list', $delta = 0, $edit = array()) { 
  if (
$op == "list") {
   
// Generate listing of blocks from this module, for the admin/block page
   
$block = array();
   
$block[0]["info"] = t('On This Date');
    return
$block;
  }
}
by 蘇德宙, 2011-05-09 15:06, 人氣(1576)
 
if ($op == 'view') {
    $block['subject'] = 'OnThisDate Subject'; 
    $block['content'] = 'Onthisdate content';
    return $block;
}