Hello all.
I have a database on news article and want to create a simple module that can list all the titles and there publication date. Since there will be thousands of article, I am planning to show titles of only 10 news article at a time and include "next 10" and "prev 10". I am not sure how can I maintain the current value and decide which button was clicked. Below is the code of what I am up to. Particularly look at getOutput() function. I have two questions
1. Am I doing right or there is better way to do this
2. Currently my code is not working properly. What might be the reason
<?php
// help section
function viewer_help($section) {
$output = '';
switch ($section) {
case 'admin/modules#description':
$output .= t('Module defines custom blocks for [site]');
break;
}
return $output;
}
function viewer_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$block[0]['info'] = t('Quick Browse');
break;
case 'view':
$block['subject'] = t('Quick Browse');
$block['content'] = getOutput();
break;
}
return $block;
}
// this is where i am creating a form, and buttons
function getOutput() {
$value = 0;
if(isset($_POST['index'])) $value = $_POST['index'];
$form = '
';
$form .= form_hidden('index', $value); // I thought creating a hidden variable might help but is not helping