Author Topic: How to Show categories like this ?  (Read 6091 times)

0 Members and 1 Guest are viewing this topic.

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
How to Show categories like this ?
« 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

Sorry if i am posting this in the wrong forum.
I m not a  Programmer.
          But
I m a Good Learner.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to Show categories like this ?
« Reply #1 on: August 24, 2006, 07:06:24 AM »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: How to Show categories like this ?
« Reply #2 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 ???
I m not a  Programmer.
          But
I m a Good Learner.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: How to Show categories like this ?
« Reply #3 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 ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: How to Show categories like this ?
« Reply #4 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)

I m not a  Programmer.
          But
I m a Good Learner.