4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Fastian on August 23, 2006, 08:42:02 PM

Title: How to Show categories like this ?
Post by: Fastian on August 23, 2006, 08:42:02 PM
Hi

See this link http://ecard.lifeshore.com/ecard-cars-39-2006-bentley-azure2-473.htm
Can you tell me what would be the best way to show categores like this ??
And is it possible to show this on a custom template as well.
The site is by maxpaul  (http://www.4homepages.de/forum/index.php?action=profile;u=12575)

Sorry if i am posting this in the wrong forum.
Title: Re: How to Show categories like this ?
Post by: V@no on August 24, 2006, 07:06:24 AM
I think it started from this topic:
http://www.4homepages.de/forum/index.php?topic=12784.0
Title: Re: How to Show categories like this ?
Post by: Fastian on August 24, 2006, 03:50:03 PM
I think it started from this topic:
http://www.4homepages.de/forum/index.php?topic=12784.0

Thanks V@no for your reply.
I found more exact match to this from this thread. And its your post.
http://www.4homepages.de/forum/index.php?topic=8682.msg40823#msg40823

I want to change it slightly.
 I am trying my self but i will need your help as well. Should i ask it here or in the other thread ???
Title: Re: How to Show categories like this ?
Post by: mawenzi on August 24, 2006, 03:55:48 PM
... the MOD that resulted from this thread is MOD Sitemap v1.0 ...
... try this -> http://www.4homepages.de/forum/index.php?topic=9299.0 ...
Title: Re: How to Show categories like this ?
Post by: Fastian on August 24, 2006, 04:20:32 PM
I do have Sitemap mod but i am not sure if i would be able to change it to get what i want.
All i want to is to show list of categories in left column like the site in my first post.

The following code of V@no did work well.
ok, guys, here is a "ripoff" from ACP -> Edit categories

1) insert into includes/functions.php:
Code: [Select]
function get_category_html_bits($cat_id = 0, $cid = 0, $depth = 1) {
  global $site_db, $html_cat_cache, $cat_cache, $site_sess;

  if (!isset($html_cat_cache[$cid])) {
    return "";
  }
  $category_list = "";
  foreach ($html_cat_cache[$cid] as $key => $category_id) {
    if (check_permission("auth_viewcat", $category_id)) {
      if ($depth > 1) {
        $category_list .= str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $depth - 1)."<img src=\"".get_gallery_image("folder_path.gif")."\" alt=\"\">\n";
      }
      $category_list .= "<img src=\"".get_gallery_image("folder.gif")."\" alt=\"\"><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$category_id)."\">".$cat_cache[$category_id]['cat_name']."</a></b><br />";
      $category_list .= get_category_html_bits($cat_id, $category_id, $depth + 1);
    }
  }
  unset($html_cat_cache[$cid]);
  return $category_list;
}

Then insert into index.php or any other files where u want the category list to be displayed, above
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
this block:
Code: [Select]
$html_cat_cache = $cat_parent_cache;
$site_template->register_vars(array(
  "categories_list" => get_category_html_bits()
));

3) Now, in the "main" template (home.html) that is associates with the file u've insert the code (index.php) use this tag: {categories_list}

P.S. almost forgot, copy admin/images/folder_path.gif into templates/<your template>/images/ folder

 I just want few extra things if possible.

1) Is it possible to show different folder images for main category & subcategory?
2) Is it possible to show "new" with category name which have new images.
3) And finally if possible i would like to show expanded/collapsed categories menu like in ACP of version 1.7.2
(I already have 110 categories and about to add 50 more. So it will be nice to have this effect)