$idx = new mk_s;
class mk_s {
function mk_s() {
global $mkportals, $mklib, $Skin;
switch($mkportals->input['op']) {
case 'show':
$this->show();
break;
case 'cat':
$this->cat();
break;
default:
$this->main();
break;
}
}
function main() {
global $mkportals, $DB, $std, $print, $mklib, $Skin, $mklib_board;
$output="
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">
<tr class='cats'>
<td id='list'> КАТЕГОРИИ</td>
</tr>
";
}
// выбираем из бд категории
$query = $DB->query("SELECT * FROM my_table_cat ORDER BY `id` DESC");
while( $row = $DB->fetch_row($query)) {
$id = $row['id'];
$name = $row['name'];
$output="
<tr class='cats'>
<td id='list'> <a href='/index.php?ind=mymodule&op=cat&iden=$id'>$name</a> </td>
</tr>
";
}
$output="
</table>
";
$blocks .= $Skin->view_block("{$mklib->lang['qu_pagetitle']}", $output);
$mklib->printpage("1", "1", $mklib->sitename.$name, $blocks);
}
function cat() {
global $mkportals, $DB, $std, $print, $mklib, $Skin, $mklib_board;
$ide = intval($mkportals->input['iden']);
$output="
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">
";
}
// выбираем из бд статьи данной категории
$query = $DB->query("SELECT * FROM my_table WHERE catid=$ide ORDER BY `id` DESC");
while( $row = $DB->fetch_row($query)) {
$id = $row['id'];
$name = $row['name'];
$output=
"
<tr class='cats'>
<td id='list'> $name </td>
<td id='list'> <a href='/index.php?ind=mymodule&op=show&ide=$id'>Подробнее</a> </td>
</tr>
";
}
$output="
</table>
";
$blocks .= $Skin->view_block("{$mklib->lang['qu_pagetitle']}", $output);
$mklib->printpage("1", "1", $mklib->sitename.$name, $blocks);
}
function show() {
global $mkportals, $DB, $std, $print, $mklib, $Skin, $mklib_board;
$ide = intval($mkportals->input['ide']);
$output="
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">
";
}
// выводим выбранную статью
$query = $DB->query("SELECT * FROM my_table WHERE id=$ide ");
$row = $DB->fetch_row($query);
$id = $row['id'];
$name = $row['name'];
$descr = $row['descr'];
$output=
"
<tr '>
<td id='list'><h2> $name </h2></td>
</tr>
<tr >
<td id='list'>$descr </td>
</tr>
";
$output="
</table>
";
$blocks .= $Skin->view_block("{$mklib->lang['qu_pagetitle']}", $output);
$mklib->printpage("1", "1", $mklib->sitename.$name, $blocks);
}
}