function scrolltext_block in ScrollText 5
Same name and namespace in other branches
- 6 scrolltext.module \scrolltext_block()
Implementation of hook_block().
File
- ./
scrolltext.module, line 93 - This module used for scrolling text from node title
Code
function scrolltext_block($op = 'list', $delta = 0) {
global $user;
if ($op == 'list') {
$blocks[0]['info'] = 'ScrollText';
return $blocks;
}
if ($op == 'view') {
switch ($delta) {
case 0:
$block['subject'] = t('<none>');
$block['content'] = '';
$scrolltext_speed = variable_get('scrolltext_speed', '1');
$scrolltext_width = variable_get('scrolltext_width', '100%');
$scrolltext_height = variable_get('scrolltext_height', '100');
$scrolltext_nodetype = variable_get('scrolltext_nodetype', 'page,story');
$scrolltext_count = variable_get('scrolltext_count', '10');
$sql = "SELECT n.title FROM {node} n ORDER BY n.created DESC LIMIT {$scrolltext_count}";
$results = db_query($sql);
$block['content'] = '<div id="scrolltext"><marquee>';
while ($data = db_fetch_object($results)) {
$block['content'] .= l("{$data->title}", "node/{$data->nid}") . str_repeat(' ', 5);
}
$block['content'] .= '</marquee></div>';
break;
}
return $block;
}
}