V.2. Thanks to V@no (were have I heard that before
:
) and his performance tuning and 4images knowledge I have updated the part of this mod that changes the page_header.php file.
If you have already installed this mod don't worry just change the bit you added in the page_header.php file with the new code.I'm afraid I can take no credit of this re-write at all. All must go to V@no.
I think for now on we should all come up with the ideas and V@no writes them up for us
This Mod creates a table that displays the number of new images in each category (that has new images)
and provides links to the search page that will only display new images for that specific category.
It will only show categories that the user has access to.
To see this in action just look at the left side column of my site under the Random Image
http://www.newman.d2g.com/Time to add Mod:
15-20 minutes
Files Changed
- includes/page_header.php
- Search.php
- templates/your_template/home.html
Note: As usual - BACKUP all of these files before changing them.
Edit includes/page_header.php
At the end of the page before:
?>
Add:
//-----------------------------------------------------
//---Show New Image count in category------------------
//-----------------------------------------------------
$new_image_category = "<table border=1 cellpadding=3 cellspacing=1 width=\"100%\">";
foreach ($new_image_cache as $key => $val) {
if ($val && check_permission("auth_viewcat", $key)) {
$category_link = "<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_new_images=1&cat_id=".$key."&sub_cat=no")."\">".$val."</a>";
$new_image_category .= "<tr><td><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cat_cache[$key]['cat_id'])."\">".$cat_cache[$key]['cat_name']."</a></td><td><b>".$category_link."</b></td></tr>";
}
}
$new_image_category .= "</table>";
$site_template->register_vars("new_image_cats", $new_image_category);
unset($new_image_category);
Edit Search.php
Find:
if (isset($HTTP_POST_VARS['search_fields'])) {
$search_fields = trim($HTTP_POST_VARS['search_fields']);
}
else {
$search_fields = "all";
}
Add After:
//-----------------------------------------------------
//---Show New Image count in category Mod -------------
//-----------------------------------------------------
if (isset($HTTP_GET_VARS['sub_cat'])) {
$sub_cat = trim($HTTP_GET_VARS['sub_cat']);
}
else
{
$sub_cat = isset($HTTP_POST_VARS['sub_cat']) ? trim($HTTP_POST_VARS['sub_cat']) : 1;
}
if (isset($HTTP_GET_VARS['cat_id'])) {
$search_cat = intval($HTTP_GET_VARS['cat_id']);
}
else {
$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
}
//-----------------------------------------------------
//---End of Show New Image count in category Mod ------
//-----------------------------------------------------
Be careful with this bit, make shure you have all the }'s in placeFind:
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
$cat_id_sql .= ", ".$search_id['search_cat'];
if (!empty($sub_cat_ids[$search_id['search_cat']])) {
foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
if (check_permission("auth_viewcat", $val)) {
$cat_id_sql .= ", ".$val;
}
}
}
}
Replace with:
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
$cat_id_sql .= ", ".$search_id['search_cat'];
if ($sub_cat != "no") { // Show New Image count in category Mod
if (!empty($sub_cat_ids[$search_id['search_cat']])) {
foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
if (check_permission("auth_viewcat", $val)) {
$cat_id_sql .= ", ".$val;
}
}
}
} // Show New Image count in category Mod
}
In your home.html file
Add:
{new_image_cats}
where you want the "New images in Category" to appear.
That's all there is to it.
Have fun
Fugaziman