Author Topic: [Mod] Previous < > Next Category (zapp through the categories)  (Read 6027 times)

0 Members and 1 Guest are viewing this topic.

Rembrandt

  • Guest
Hi!

It works the same as on the details pages, just with the categories.

1.) search in categories.php:

//-----------------------------------------------------
//--- Show Categories ---------------------------------

insert above:

//################### START [Mod]Previous < > Next Category ##################################
if (check_permission("auth_viewcat"$cat_id)) {
  
$zapp_cache = array();
  if (
in_array($cat_id$cat_parent_cache[0])){
    foreach (
$cat_parent_cache[0] as $val) {
      if(
check_permission("auth_viewcat"$val)) {
        
$zapp_cache[] = $val;
      }
    }
  }
  else{
    foreach (
$cat_parent_cache[$cat_cache[$cat_id]['cat_parent_id']] as $val) {
      if (
check_permission("auth_viewcat"$val)) {
        
$zapp_cache[] = $val;
      }
    }
  }
  
  
$act_key array_search($cat_id$zapp_cache);
  
$last_key  count($zapp_cache) - 1;
  
$next_cat_id = (isset($zapp_cache[$act_key 1])) ? $zapp_cache[$act_key 1] : $zapp_cache[0];
  
$prev_cat_id = (isset($zapp_cache[$act_key 1])) ? $zapp_cache[$act_key 1] : $zapp_cache[$last_key];
  unset(
$zapp_cache);
}

if (!empty(
$cat_cache[$next_cat_id])) {
  
$next_cat_name format_text($cat_cache[$next_cat_id]['cat_name'], 2);
  
$next_cat_url $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$next_cat_id);
}

if (!empty(
$cat_cache[$prev_cat_id])) {
  
$prev_cat_name format_text($cat_cache[$prev_cat_id]['cat_name'], 2);
  
$prev_cat_url $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$prev_cat_id);
}
//################### End [Mod]Previous < > Next Category ##################################

search:

$site_template
->register_vars(array(
  
"categories" => get_categories($cat_id),

insert below:

//######### START [Mod]Previous < > Next Category #########
  
"next_cat_id" => $next_cat_id,
  
"next_cat_name" => $next_cat_name,
  
"next_cat_url" => $next_cat_url,
  
"prev_cat_id" => $prev_cat_id,
  
"prev_cat_name" => $prev_cat_name,
  
"prev_cat_url" => $prev_cat_url,
  
"lang_prev_cat" => $lang['prev_cat'],
  
"lang_next_cat" => $lang['next_cat'],
//######## End [Mod]Previous < > Next Category ############


2.) search in your lang/main.php "?>" and insert above:
(deutsch)

//########## START [Mod]Previous < > Next Category #########
$lang['prev_cat'] = "Vorherige Kategorie:";
$lang['next_cat'] = "Nächste Kategorie:";
//########## End [Mod]Previous < > Next Category ###########

(english)

//########## START [Mod]Previous < > Next Category #########
$lang['prev_cat'] = "Previous Category:";
$lang['next_cat'] = "Next Category:";
//########## End [Mod]Previous < > Next Category ###########


3.) search in your Templates/categories.html
Code: [Select]
<hr size="1">
and insert below (or where ever you want):
Code: [Select]
               <table width="100%" border="0" cellspacing="0" cellpadding="1">
                  <tr>
                    <td class="bordercolor">
                      <table width="100%" border="0" cellspacing="0" cellpadding="3">
                          <tr valign="top">
                            <td class="row2"> {if prev_cat_name}{lang_prev_cat}<br>&nbsp;&nbsp;
                              <b><a href="{prev_cat_url}">{prev_cat_name}</a></b>{endif prev_cat_name}&nbsp;
                            </td>
                            <td align="right" class="row2"> &nbsp;{if next_cat_name}{lang_next_cat}<br>
                              <b><a href="{next_cat_url}">{next_cat_name}</a>&nbsp;&nbsp;&nbsp;</b>{endif next_cat_name}
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                  <br>

mfg Andi
« Last Edit: February 07, 2013, 05:39:05 AM by Rembrandt »

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Mod] Previous < > Next Category (zapp through the categories)
« Reply #1 on: August 23, 2012, 09:49:06 PM »
Mein Held...
PERFEKT

Danke
Danke Harald