<?php
if(!defined('PK_MAGIC'))
die('hack or what?');
/* */
$q = "
SELECT
ca.cat_id,
ca.cat_title
FROM
" . HEADS_TABLE . " he,
" . CATS_TABLE . " ca
WHERE
ca.head_id = he.head_id AND
ca.cat_is_deleted = 0
ORDER BY
he.head_pos ASC,
ca.cat_pos ASC
";
$cat_res = $db->query($q);
$cat_count = $db->num_rows($cat_res);
$tpl->add_var('CAT_COUNT', $cat_count);
for($cat_i = 0; $cat_i < $cat_count; $cat_i++)
{
$cat_row = $db->fetch_row($cat_res);
$tpl->add_block_vars
(
'cats',
array
(
'TITLE' => html_escape($cat_row['cat_title']),
'URL' => html_escape(make_url('cat', array('cat_id' => $cat_row['cat_id'])))
)
);
}
?>