BTW how do I use it in 4images itself?)
Like this -
// Step 1
In includes/page_header.php file,
find:
//-----------------------------------------------------
//--- Random Image ------------------------------------
//-----------------------------------------------------
add after:
$num_cats = (defined('RANDOM_CATS_VALUE') && RANDOM_CATS_VALUE > 0) ? "LIMIT " . (int)RANDOM_CATS_VALUE : "";
$sql = "SELECT cat_id, cat_name
FROM ".CATEGORIES_TABLE."
WHERE auth_viewcat=".AUTH_ALL."
ORDER BY RAND()
" . ((isset($num_cats)) ? $num_cats : "");
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (isset($num_rows) && $num_rows > 0) {
$random_cats_template = "";
while ($row = $site_db->fetch_array($result)){
$cat_id = $row['cat_id'];
$cat_name = $row['cat_name'];
$site_template->register_vars(array(
"cat_id" => (int)$cat_id,
"cat_name" => format_text($cat_name, 2),
"cat_url" => $site_sess->url(ROOT_PATH . "categories.php?" . URL_CAT_ID . "=" . (int)$cat_id),
"num_rows" => (int)$num_rows
));
$random_cats_template .= $site_template->parse_template("random_cats");
$site_template->register_vars("random_cats_template", trim($random_cats_template));
}
}
// Step 2
In includes/constants.php file,
add after ?>:
define('RANDOM_CATS_VALUE', 10);
// Step 3
In your templates/your_template folder, create file:
random_cats.html .
Create HTML table and use:
{cat_id}
{cat_name}
{num_rows}
and for {cat_url}
<a href="{cat_url}" class="link" />{cat_name}</a>
// Step 4
Add: {random_cats_template}
anywhere HTML template (ones with:
{header} and {footer} - other no work).