4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on May 11, 2003, 05:01:00 AM

Title: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: V@no on May 11, 2003, 05:01:00 AM
Many people asked about a MOD, that would let limit number of categories per page.

Installation:

Step 1.
Open /function.php
Find:
Code: [Select]
global $site_template, $site_db, $site_sess, $config, $lang;Replace with:
Code: [Select]
global $site_template, $site_db, $site_sess, $config, $lang, $HTTP_GET_VARS;
Step 1.2. (updated 05-27-03)
Find:
Code: [Select]
  $total = sizeof($visible_cat_cache);Add after:
Code: [Select]
//Begin configuration:

$perpage = 10; //how many categories per page
$cat_text = "Found {total_cat_images} categories on {total_pages} page(s). Displayed category {first_page} to {last_page}";

//u can use those tags:
//{total_cat_images} - total categories
//{total_pages} - total pages
//{first_page} - displayed from (number first category displayed)
//{last_page} - displayed to (number last category displayed)
//End configuration

$page = (isset($HTTP_GET_VARS['cat_page'])) ? $HTTP_GET_VARS['cat_page'] : 0;
if (!class_exists("Paging")) {
  include(ROOT_PATH.'includes/paging.php');
}
$link_arg = $site_sess->url(ROOT_PATH.($cat_id ? "categories.php?".URL_CAT_ID."=".$cat_id : "index.php"));
$getpaging = new Paging($page, $perpage, $total, $link_arg, $cat_text, "", "cat_page");
$offset = $getpaging->get_offset();
$limit = ($offset + $perpage > $total) ? $total : $offset + $perpage - 1;
$total = $limit - $offset;
$site_template->register_vars(array(
  "cat_paging" => $getpaging->get_paging(),
  "cat_paging_stats" => $getpaging->get_paging_stats()
));
$cache = array();
$i = 0;
foreach ($visible_cat_cache as $key => $category_id) {
  if ($i >= $offset && $i <= $limit) {
    $cache[] = $category_id;
    $cache_sql .= (($cache_sql != "") ? ", " : "").$category_id;
  }
  $i++;
}
$total = count($cache);
You can change some setting at the beginning of inserted code ;)

Step 1.3.
Find:
Code: [Select]
foreach ($visible_cat_cache as $key => $category_id) {Replace with:
Code: [Select]
foreach ($cache as $category_id){

Step 2. (updated 05-27-03)
If u have not updated your /includes/paging.php file, then download it from Universal Paging Class (http://www.4homepages.de/forum/index.php?topic=5761.0)


Step 3.
Add in /templates/<yourtemplate>/categories.html and in /templates/<yourtemplate>/home.html
those tags:
{cat_paging} and if u want {cat_paging_stats}


Step 4 (added 07-06-2006)
This step needed only for these who is using 4images v1.7 with [MOD] Cache System for 4images v1.7 (http://www.4homepages.de/forum/index.php?topic=8476.0) or 4images v1.7.1, v1.7.2 with activated cache system.
In index.php and categories.php find:
Code: [Select]
    isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
Insert above:
Code: [Select]
    isset($HTTP_GET_VARS['cat_page']) ? intval($HTTP_GET_VARS['cat_page']) : 0,
Title: [MOD] limited number of categories per page
Post by: lakeside on May 11, 2003, 09:03:07 PM
It works fine, but I get an error at the top of my categories pages that says:
Warning: Division by zero in /home/xxxx/xxxxx/gallery/includes/functions.php on line 1024
 

The following is whats on line 1024 of my functions.php

Code: [Select]
$table_rows = $total / $table_columns;
Title: [MOD] limited number of categories per page
Post by: V@no on May 11, 2003, 09:43:48 PM
two solutions:
1. check your 4images settings, what number is set under "Number of table cells" it must be atleast 1
2. if above variant wont help, then try to replace:
Code: [Select]
if ($total <= $table_columns) {with:
Code: [Select]
if ($total <= $table_columns || !$table_columns) { but this is not supposed to be like that...
Title: [MOD] limited number of categories per page
Post by: lakeside on May 11, 2003, 10:35:42 PM
In my settings it lists 2 for table cells

I've replaced what you said, but it still gives the same error.

Okay, after looking some more, I see that indeed it does list 2 for table cells, but I now changed it to 3, and it works fine with what you posted above for changes.

Thanks,

P.S.
I dont know if this is related to this or not, but I have it set to display 20 categories, but it shows 21 categories on the first page, and shows the following:
Found 26 galleries on 2 page(s). Displaying Galleries 1 to 20
when in reality it's displaying 21 categories not 20.
Title: Re: [MOD] limited number of categories per page
Post by: Gawd on May 18, 2003, 01:07:24 PM
Quote from: V@no

Step 1.2.
Find:
Code: [Select]
$total = count($visible_cat_cache);

I can't find that bit of code.... Searched the entire site.
the closest I could find to that is the following.

Code: [Select]
$total = sizeof($visible_cat_cache);

But when I added what you said after that it would only place 1 category in each column, and then all remaining categories in the last column on the page.
Title: Re: [MOD] limited number of categories per page
Post by: V@no on May 18, 2003, 06:23:11 PM
Quote from: Gawd
I can't find that bit of code.... Searched the entire site.
the closest I could find to that is the following.

ops...yes, u are right...that's how 4images comes by default...I have changed all sizeof operators in all files, because they are alias for count: http://www.php.net/manual/en/function.sizeof.php and might be deleted or renamed to something else in next versions of PHP.

Quote from: Gawd
But when I added what you said after that it would only place 1 category in each column, and then all remaining categories in the last column on the page.
maybe u might also need this fix:
http://4homepages.de/forum/viewtopic.php?t=3160
Title: [MOD] limited number of categories per page
Post by: mantra on May 19, 2003, 04:07:39 AM
Quote
The new file in Step 2. is more universal then default /includes/pagin.php. Because of that, u can use that file if u want add different types of paging system or more then one for different types of whatever u do  
I will post separate thread for people who might need it.


Can you give me example V@no :?:
Title: [MOD] limited number of categories per page
Post by: Gawd on May 19, 2003, 12:10:00 PM
Thanx, I'll give it a try as soon as I have my template done, and am ready to start putting the categories in again (stupid lop.com messed me up lost my mysql db as i was getting rid of it.)
Title: [MOD] limited number of categories per page
Post by: V@no on May 27, 2003, 09:33:33 PM
Found very bad bug :oops:
Because of witch it didnt displayed properly subcategories, when their ID did follow each other (3, 10, 45, 40)

I have corrected my post, but who already installed this mod, u'll need do this:
In my peace of code find:
Code: [Select]
foreach ($visible_cat_cache as $key => $category_id) {
if ($key >= $offset && $key <= $limit) {
$cache[] = $category_id;
}
}
replace with:
Code: [Select]
$i = 0;
foreach ($visible_cat_cache as $key => $category_id) {
if ($i >= $offset && $i <= $limit) {
$cache[] = $category_id;
    $cache_sql .= (($cache_sql != "") ? ", " : "").$category_id;
}
$i++;
}


also, no need anymore create new allpaging.php file now u can use Univeral Paging Class (http://come.no-ip.com/files.php?id=18)
Title: Re: [MOD] limited number of categories per page
Post by: uksoreeyes on June 14, 2003, 03:07:19 AM
Quote from: V@no
Quote from: Gawd
I can't find that bit of code.... Searched the entire site.
the closest I could find to that is the following.

ops...yes, u are right...that's how 4images comes by default...I have changed all sizeof operators in all files, because they are alias for count: http://www.php.net/manual/en/function.sizeof.php and might be deleted or renamed to something else in next versions of PHP.

Does this mean that we should change all the
Code: [Select]
$total = sizeof($visible_cat_cache);
in functions.php to

Code: [Select]
$total = count($visible_cat_cache);
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 14, 2003, 11:23:25 PM
Quote from: uksoreeyes

Does this mean that we should change all the
Code: [Select]
$total = sizeof($visible_cat_cache);
in functions.php to

Code: [Select]
$total = count($visible_cat_cache);

wont hurt ;)
Title: Re: [MOD] limited number of categories per page
Post by: Legendary on June 04, 2005, 02:10:16 PM
I could not get this to work.  Its really weird some how.  I have the latest paging.php, and i installed everything as directions.  But somehow, when you click on page 2, it just doesn't go to page 2.

you can visit: http://idols-unlimited.com to see this. 

it didn't give me any error either, but the page doesn't load page 2, 3, 4..etc
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 04, 2005, 03:51:05 PM
you can visit: http://idols-unlimited.com to see this.
where exactly is it? I couldnt find any paging there...
Title: Re: [MOD] limited number of categories per page
Post by: Tiburon on June 21, 2005, 11:32:53 AM
v@no

I have the same problem like Legendary.

There ist no problem installing the Mod and the "{cat_paging}" is shown on categories.html. There is also the number of categories on the page that I wrote into functions.php.

The only thing that does not work is that I can´t go to page 2 or 3 or 4. When I click on page 2 it shows again page 1 and so on. Really frustrating !  :(
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 21, 2005, 02:31:22 PM
below this line:
Code: [Select]
$page = (isset($HTTP_GET_VARS['cat_page'])) ? $HTTP_GET_VARS['cat_page'] : 0;Insert:
Code: [Select]
echo $page;
Then go to second or third page and see what number it shows.
Title: Re: [MOD] limited number of categories per page
Post by: Tiburon on June 21, 2005, 03:30:14 PM
Hi v@no, thx for your answer but the problem are not the numbers, the problem is that there is no page number 2,3,4.

It is always page number 1 that is shown with the first 10 galleries and users cant get access to galleries which should be on page 2,3,4  :?

Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 22, 2005, 04:52:53 AM
make sure u did step 2
Title: Re: [MOD] limited number of categories per page
Post by: Tiburon on June 22, 2005, 11:36:35 AM
I did step 2, means I replaced the old paging.php with your new version.

It seems to change the site (because the pages loads again) also it accepts configurations I do in functions.php (e.g. changing number of categories per page) but there are always only the first categories.  :cry:
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 22, 2005, 02:31:33 PM
can I see it?
Title: Re: [MOD] limited number of categories per page
Post by: Tiburon on June 22, 2005, 03:28:44 PM
Yep !

http://www.hintergrundbilder.de/wallpaper/categories.php?cat_id=1
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 23, 2005, 12:44:07 AM
I can tell u right now, you did not do Step 2.
Please tripple check that u've uploaded the correct paging.php to the correct path. (/includes/paging.php)

If u look at the url of page 2 on your site, u can see page=2 which is would be with the default paging.php. With new paging.php it should be cat_page=2 instead.
Title: Re: [MOD] limited number of categories per page
Post by: Tiburon on June 23, 2005, 08:58:40 AM
Well, I checked it again and I have downloaded the paging.php again (it is from 11/02/2005) and I loaded it up again into includes/paging.php and nothing changes.  :(

Wenn i load up the old one I get this error:

Fatal error: Cannot redeclare class paging in /pages/69/fa/d0003121/htdocs/hintergrundbilder/wallpaper/includes/paging.php on line 28

So it ist only the new one that works.


Title: Re: [MOD] limited number of categories per page
Post by: Loet on June 25, 2005, 01:26:41 AM
Hi,

I also tryed this Mod and also cannot get it to work.
Have the same problems, it shows the pages but nothing happens when you click them.
Also did the echo page by V@no, it gives a 0.
Would be nice to get it working because we in some categories more than 50 subcategories.
It would be very nice to get it fixed...

Thanks,

Loet
Title: Re: [MOD] limited number of categories per page
Post by: cneal on June 25, 2005, 03:26:39 AM
hi.  :D i'm having the same problem. are u sure you have the correct file online for us to download? isn't $page_text : "page"; supposed to be like $page_text : "cat_page"; or something like that? this file: http://gallery.vano.org/file18 doesn't have "cat_page" listed anywhere in it.
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 25, 2005, 04:49:07 AM
ok, try replace from step 1.2 $HTTP_GET_VARS with $_GET

@cneal:
cat_page is an extra argument this mod sends to the paging class, that's why the new paging class needed which can handle new stuff.
Title: Re: [MOD] limited number of categories per page
Post by: Loet on June 26, 2005, 11:40:12 AM
V@no,

I made all the changes, but no result.
BTW, I did a fresh install of 4Images 1.7.1 to test, no other MODS installed.

Maybee this is of some help.
I have put this code in categories.html and I saw that cat_paging_stat is not working.
Code: [Select]
<br><b>
test cat_paging<br></b>
{cat_paging}<br><b>
test cat_paging_stats<br>
{cat_paging_stats}</b>
<br />

And it shows this (screenshot):
(http://ljvo.info/paging.gif)

The link it creates to go the next page is also not completely filled.
It looks like:
"http://medion2/4images/categories.php?cat_id=157&sessionid=a37ea6ad09301c8ae0c4f3914a91c734&page=2#Found  categories on  page(s). Displayed category  to"

So it looks like the script does not know on what page it is.
It stays "0"
Any idea? :?:

Loet
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 26, 2005, 12:51:53 PM
ok, guys, my bad, seems to me I've updated the paging class after this mod was created...
So, try to replace in Step 1.2:
Code: [Select]
$getpaging = new Paging($page, $perpage, $total, $link_arg, "cat_page", $cat_text);with this:
Code: [Select]
$getpaging = new Paging($page, $perpage, $total, $link_arg, $cat_text, "", "cat_page");
Title: Re: [MOD] limited number of categories per page
Post by: Tiburon on June 26, 2005, 02:13:12 PM
Ok guys, good work, you made V@no believe that it was not me, forgetting step 2. GREAT !  :)

@ V@no, you got it ! Seems that it works perfectly now.  :mrgreen: :mrgreen: :mrgreen:

THANKS  :) :) :)
Title: Re: [MOD] limited number of categories per page
Post by: Loet on June 26, 2005, 04:15:02 PM
Thanks V@no.

Paging works now, perfect.
The only thing that it does not show is the total number of categories in the cat_paging_stats.
Not a big problem, just do not use cat_paging_stats, but is there a way to get that value in {total_something}?

Loet

Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 26, 2005, 08:55:54 PM
omg....huh? :?

wierd...replace total_something with total_cat_images
or redo Step 1.2, its fixed now.
Title: Re: [MOD] limited number of categories per page
Post by: Loet on June 26, 2005, 09:24:27 PM
V@no,

Everything fixed.
 :D Thanks again...

Loet

Title: Re: [MOD] limited number of categories per page
Post by: cneal on June 27, 2005, 12:32:28 AM
thanks! i was able to limit the number of catergories shown on my home.html page, but is there a way to add navigation for categories not shown on the home.html page? example: say i have 50 catergories and i want only 10 catergories diplayed on my home.html page. is there a way to add a link to the next page to display the next 10 catergories, etc.?
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 27, 2005, 02:06:29 AM
sorry, I dont think I understand your question.
This mod should affect home page as well as categories page....
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 08, 2005, 01:58:14 PM
ok i read all the posts to this topic. i'm a little bit in disorder. i'm so far, that it shows the number of categories i want and the cat_paging. but i've still the problem  that i can't go to page number 2,3,4......

function.php looks like that

//Begin configuration:

$perpage = 3; //how many categories per page
$cat_text = "Found {total_cat_images} categories on {total_pages} page(s). Displayed category {first_page} to {last_page}";

//u can use those tags:
//{total_cat_images} - total categories
//{total_pages} - total pages
//{first_page} - displayed from (number first category displayed)
//{last_page} - displayed to (number last category displayed)
//End configuration

$page = (isset($HTTP_GET_VARS['cat_page'])) ? $HTTP_GET_VARS['cat_page'] : 0;
if (!class_exists(Paging)) {
include(ROOT_PATH.'includes/paging.php');
}
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);
$getpaging = new Paging($page, $perpage, $total, $link_arg, $cat_text, "", "cat_page");
$offset = $getpaging->get_offset();
$limit = ($offset + $perpage > $total) ? $total : $offset + $perpage - 1;
$total = $limit - $offset;
$site_template->register_vars(array(
 "cat_paging" => $getpaging->get_paging(),
 "cat_paging_stats" => $getpaging->get_paging_stats()
));
$cache = array();
$i = 0;
foreach ($cache as $category_id){
if ($i >= $offset && $i <= $limit) {
$cache[] = $category_id;
   $cache_sql .= (($cache_sql != "") ? ", " : "").$category_id;
}
$i++;
}
$total = count($cache);


paging.php i've downloaded here http://gallery.vano.org/file18dl

so what could be wrong
Title: Re: [MOD] limited number of categories per page
Post by: V@no on August 08, 2005, 02:06:18 PM
what do u see in the url to the page 2,3,4? do u use page=2 or do u see cat_page=2 ?
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 08, 2005, 02:08:16 PM
cat_page, i think i head also page, but i'm not shure. what's the wright one?
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 08, 2005, 02:12:11 PM
ok it should be cat_page, like it is.

is it correct like that
domain/categories.php?cat_id=0&cat_page=2

cat_id is everytime 0 is this correct?
Title: Re: [MOD] limited number of categories per page
Post by: V@no on August 09, 2005, 12:26:22 AM
ok it should be cat_page, like it is.

is it correct like that
domain/categories.php?cat_id=0&cat_page=2

cat_id is everytime 0 is this correct?
no, its not correct...
are you sure u inserted the code from step 1.2 in the correct place?
I just realized that the string u were supposed to find in that step was misspelled, instead of
Code: [Select]
  $total = count($visible_cat_cache); it was supposed to be
Code: [Select]
  $total = sizeof($visible_cat_cache);(the original post updated)
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 11:39:03 AM
I changed what you wrote. But it doesn't work.

An other question, should this be like that?
  global $site_template, $site_db, $site_sess, $config, $lang, $HTTP_GET_VARS;
or like that
  global $site_template, $site_db, $site_sess, $config, $lang, $_GET;


Title: Re: [MOD] limited number of categories per page
Post by: TheOracle on August 09, 2005, 01:23:38 PM
4images is fully based on superglobals, so it's this one :

Quote

global $site_template, $site_db, $site_sess, $config, $lang, $HTTP_GET_VARS;


;)
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 01:51:29 PM
that isn't the problem. but what i found out:

with
Quote
foreach ($visible_cat_cache as $key => $category_id) {
it works and i see the categories, limited by the script.

with
Quote
foreach ($cache as $category_id){
i can't see the categories


Title: Re: [MOD] limited number of categories per page
Post by: TheOracle on August 09, 2005, 01:52:49 PM
Quote

i can't see the categories


Correct. It has to stay with the $visible_cat_cache.
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 01:57:56 PM
Quote
Correct. It has to stay with the $visible_cat_cache.

so why is in the manual step 1.3 written,

Quote
Find:
Code:
foreach ($visible_cat_cache as $key => $category_id) {
Replace with:
Code:
foreach ($cache as $category_id){

there is my code like it is now, is anything wrong? i can't see any fault. may be you

Code: [Select]
$total = sizeof($visible_cat_cache);

//Begin configuration:

$perpage = 3; //how many categories per page
$cat_text = "Found {total_cat_images} categories on {total_pages} page(s). Displayed category {first_page} to {last_page}";

//u can use those tags:
//{total_cat_images} - total categories
//{total_pages} - total pages
//{first_page} - displayed from (number first category displayed)
//{last_page} - displayed to (number last category displayed)
//End configuration

$page = (isset($HTTP_GET_VARS['cat_page'])) ? $HTTP_GET_VARS['cat_page'] : 0;
if (!class_exists(Paging)) {
include(ROOT_PATH.'includes/paging.php');
}
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);
$getpaging = new Paging($page, $perpage, $total, $link_arg, $cat_text, "", "cat_page");
$offset = $getpaging->get_offset();
$limit = ($offset + $perpage > $total) ? $total : $offset + $perpage - 1;
$total = $limit - $offset;
$site_template->register_vars(array(
 "cat_paging" => $getpaging->get_paging(),
 "cat_paging_stats" => $getpaging->get_paging_stats()
));
$cache = array();
$i = 0;
foreach ($visible_cat_cache as $key => $category_id) {
if ($i >= $offset && $i <= $limit) {
$cache[] = $category_id;
   $cache_sql .= (($cache_sql != "") ? ", " : "").$category_id;
}
$i++;
}
$total = count($cache);
//END MOD category for each page
Title: Re: [MOD] limited number of categories per page
Post by: TheOracle on August 09, 2005, 02:05:44 PM
Perhaps I missed something regarding this functionality but

replace :

Quote

foreach ($cache as $category_id){


with :

Code: [Select]

foreach ($visible_cat_cache as $category_id){

Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 02:07:23 PM
like you can see in the code, it is already done.
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 02:09:16 PM
could someone send me his "funktion.php" ???  :mrgreen:
Title: Re: [MOD] limited number of categories per page
Post by: TheOracle on August 09, 2005, 02:09:39 PM
Quote

foreach ($visible_cat_cache as $key => $category_id) {


That is the original coding.

The instructions says :

Quote

foreach ($cache as $category_id) {


And now, replace it with :

Code: [Select]

foreach ($visible_cat_cache as $category_id) {

Title: Re: [MOD] limited number of categories per page
Post by: V@no on August 09, 2005, 02:14:12 PM
Quote

foreach ($visible_cat_cache as $key => $category_id) {


That is the original coding.

The instructions says :

Quote

foreach ($cache as $category_id) {


And now, replace it with :

Code: [Select]

foreach ($visible_cat_cache as $category_id) {


Please! u dont know what u are talking about, period!

@iraklis:
please show the block of code started from line:
Code: [Select]
function get_categories($cat_id = 0) {and ended with:
Code: [Select]
function get_category_path($cat_id = 0, $detail_path = 0) {
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 02:16:22 PM
Code: [Select]
function get_categories($cat_id = 0) {
  global $site_template, $site_db, $site_sess, $config, $lang, $HTTP_GET_VARS;
  global $cat_cache, $cat_parent_cache, $new_image_cache, $subcat_ids;

  $cattable_width = ceil((intval($config['cat_table_width'])) / $config['cat_cells']);
  if ((substr($config['cat_table_width'],-1)) == "%") {
    $cattable_width .= "%";
  }

  if (!isset($cat_parent_cache[$cat_id])) {
    return "";
  }

  $visible_cat_cache = array();
  foreach ($cat_parent_cache[$cat_id] as $key => $val) {
    if (check_permission("auth_viewcat", $val)) {
      $visible_cat_cache[$key] = $val;
    }
  }

  if (empty($visible_cat_cache)) {
    return "";
  }

$total = sizeof($visible_cat_cache);

//Begin configuration:

$perpage = 3; //how many categories per page
$cat_text = "Found {total_cat_images} categories on {total_pages} page(s). Displayed category {first_page} to {last_page}";

//u can use those tags:
//{total_cat_images} - total categories
//{total_pages} - total pages
//{first_page} - displayed from (number first category displayed)
//{last_page} - displayed to (number last category displayed)
//End configuration

$page = (isset($HTTP_GET_VARS['cat_page'])) ? $HTTP_GET_VARS['cat_page'] : 0;
if (!class_exists(Paging)) {
include(ROOT_PATH.'includes/paging.php');
}
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);
$getpaging = new Paging($page, $perpage, $total, $link_arg, $cat_text, "", "cat_page");
$offset = $getpaging->get_offset();
$limit = ($offset + $perpage > $total) ? $total : $offset + $perpage - 1;
$total = $limit - $offset;
$site_template->register_vars(array(
 "cat_paging" => $getpaging->get_paging(),
 "cat_paging_stats" => $getpaging->get_paging_stats()
));
$cache = array();
$i = 0;
foreach ($visible_cat_cache as $category_id) {
if ($i >= $offset && $i <= $limit) {
$cache[] = $category_id;
   $cache_sql .= (($cache_sql != "") ? ", " : "").$category_id;
}
$i++;
}
$total = count($cache);
//END MOD category for each page

  $table_columns = (intval($config['cat_cells'])) ? intval($config['cat_cells']) : 2;
  if ($total <= $table_columns) {
    $table_rows = 1;
  }
  else {
    $table_rows = $total / $table_columns;
    if ($total >= $table_columns && !is_integer($table_rows)) {
      $table_rows = intval($table_rows) + 1;
    }
  }

  $categories = "\n<table width=\"".$config['cat_table_width']."\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td valign=\"top\" width=\"".$cattable_width."\" class=\"catbgcolor\">\n";
  $categories .= "<table border=\"0\" cellpadding=\"".$config['cat_table_cellpadding']."\" cellspacing=\"".$config['cat_table_cellspacing']."\">\n";
  $count = 0;
  $count2 = 0;
  foreach ($cache as $category_id){
    $categories .= "<tr>\n<td valign=\"top\">\n";

    $is_new = (isset($new_image_cache[$category_id]) && $new_image_cache[$category_id] > 0) ? 1 : 0;
    $num_images = (isset($cat_cache[$category_id]['num_images'])) ? $cat_cache[$category_id]['num_images'] : 0;

    $subcat_ids = array();
    get_subcat_ids($category_id, $category_id, $cat_parent_cache);

    if (isset($subcat_ids[$category_id])) {
      foreach ($subcat_ids[$category_id] as $val) {
        if (isset($new_image_cache[$val]) && $new_image_cache[$val] > 0) {
          $is_new = 1;
        }
        if (isset($cat_cache[$val]['num_images'])) {
          $num_images += $cat_cache[$val]['num_images'];
        }
      }
    }

    if (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0 || defined("SHOW_RANDOM_CAT_IMAGE") && SHOW_RANDOM_CAT_IMAGE == 0) {
      $random_cat_image_file = "";
    }
    else {
      $random_cat_image_file = get_random_image($category_id, 0, 1);
    }

 
    if ($categories && function_exists('get_subcategories') && $num_images >= 1) {
 
    $site_template->register_vars(array(
      "cat_id" => $category_id,
      "cat_name" => $cat_cache[$category_id]['cat_name'],
      "cat_description" => $cat_cache[$category_id]['cat_description'],
      "cat_hits" => $cat_cache[$category_id]['cat_hits'],
      "cat_is_new" => $is_new,
      "lang_new" => $lang['new'],
      "sub_cats" => get_subcategories($category_id),
      "cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$category_id),
      "random_cat_image_file" => $random_cat_image_file,
      "num_images" => $num_images
    ));
   
    $categories .= $site_template->parse_template("category_bit");
    $count++;
    $count2++;
    $categories .= "</td>\n</tr>\n";
   
    } ####### End of if statement.

    if ($count == $table_rows && $count2 < sizeof($visible_cat_cache)) {
      $categories .= "</table></td>\n";
      $categories .= "<td valign=\"top\" width=\"".$cattable_width."\" class=\"catbgcolor\">\n";
      $categories .= "<table border=\"0\" cellpadding=\"".$config['cat_table_cellpadding']."\" cellspacing=\"".$config['cat_table_cellspacing']."\">\n";

      $total = $total - $count2;
      $table_columns = $table_columns - 1;
      /*if ($total <= $table_columns && $table_columns > 1) {
        $table_rows = 1;
      }
      else {
        $table_rows = $total / $table_columns;
        if ($total >= $table_columns && !is_integer($table_rows)) {
          $table_rows = intval($table_rows) + 1;
        }
      }*/
      $count = 0;
    }
  }

  $categories .= "</table>\n</td>\n</tr>\n</table>\n";
  return $categories;
}
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 02:19:48 PM
FYI

i also add this mod

http://www.4homepages.de/forum/index.php?topic=6675

but this souldn't disturb this one !?
Title: Re: [MOD] limited number of categories per page
Post by: TheOracle on August 09, 2005, 02:32:07 PM
Quote

i also add this mod


Ah ! this wasn't mentionned first. ;)

Quote

but this souldn't disturb this one !?


If that MOD is related with the same functions as this one, it might become a problem due to a slight difference of codes.
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 02:37:36 PM
in this mod you've just to configure the template category_bit.html. so don't think that this is the problem. i thought you know that with both mods combiend, there are problems. so it's not that
Title: Re: [MOD] limited number of categories per page
Post by: TheOracle on August 09, 2005, 02:40:57 PM
Quote

in this mod you've just to configure the template category_bit.html. so don't think that this is the problem. i thought you know that with both mods combiend, there are problems. so it's not that


I meant no disrespect. I was just making sure they had no conflicts. ;)
Title: Re: [MOD] limited number of categories per page
Post by: V@no on August 09, 2005, 02:45:19 PM
FYI

i also add this mod

http://www.4homepages.de/forum/index.php?topic=6675

but this souldn't disturb this one !?
no, it will not affect.

I just tested your code on a fresh 4images, the paging worked just fine, but no subcategories where showed because of
Code: [Select]
   if ($categories && function_exists('get_subcategories') && $num_images >= 1) {condition. (I dont know where this came from)


What happens if you insert above:
Code: [Select]
$total = sizeof($visible_cat_cache);this:
Code: [Select]
echo $cat_id."<br />";The idea it should show u the category id on top of the page.
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 03:00:26 PM
it's 0

like the url: domain/categories.php?cat_id=0&cat_page=4
Title: Re: [MOD] limited number of categories per page
Post by: V@no on August 09, 2005, 03:04:33 PM
just to confirm, if you uinstall this mod, do u still get 0? (I have a feeling that 0 is what u'll get without this mod)

If so, then there is something wrong in your categories.php, perhaps other mods affecting
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 03:11:00 PM
i upload the original categories.php, so that can't be the problem.

if i would write the url domain/categories.php?cat_id=3&cat_page=4 by my self. should it work? i tried it but it doesn't.

i also upload the original function.php and the cat_id is also 0
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 09, 2005, 05:47:30 PM
if i write this url in the browser domain/categories.php?cat_id=13&cat_page=2 i get the page with the pictures of categorie 13 and not the cat_page2. i don't know if it's normal!?

Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 10, 2005, 10:24:07 AM
FYI
Quote
Step 3.
Add in /templates/<yourtemplate>/categories.html
those tags:
{cat_paging} and if u want {cat_paging_stats}


i didn't change the template categories.html, i changed the home.html. i don't know if this could be the problem!?

second thing
i took the original function.php modify it like it's written in the manual, but i've the same problem.
Title: Re: [MOD] limited number of categories per page
Post by: TheOracle on August 10, 2005, 04:43:22 PM
Quote

i didn't change the template categories.html, i changed the home.html. i don't know if this could be the problem!?


In these circumstances, it must be done from categories.html and not home.html since no paging defaultly exists from home.html file.
Title: Re: [MOD] limited number of categories per page
Post by: V@no on August 10, 2005, 11:03:10 PM
And add to what TheOracle said:
If you want get proper support, do not do more and anything else but exactly what the guide told u to do ;)
Ones, its installed, tested and everything works fine, then do whatever modifications u wish.

Now, back to your problem. I have no clue what could u do to categories.php or functions.php or other files that would affect $cat_id be always 0, so, test it on a fresh 4images, perhaps retrace your steps when did other modifications, etc.
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 11, 2005, 09:48:05 AM
i first changed categories.html with no effect, so i modified home.html and it was indicated. just the problem i still have, emerged.

so i think i will try it on a fresh 4images.


thank you so far for your support and patience  :mrgreen:

regards
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 11, 2005, 01:42:04 PM
ooh man

so i try it on a fresh 4images

changes

-function.php
-categories.html

effect

-the number categories decrease  ok
-the {cat_page} isn't shown   not ok


changes 2
-function.php
-categories.html
-home.html

effect

-the number categories decrease  ok
-the {cat_page} is shown            ok
-i can't change the cat_page    not ok (cat_id=0)


attachement
home.html
categories.html
function.php

i really don't know what's wrong!!!
Title: Re: [MOD] limited number of categories per page
Post by: V@no on August 11, 2005, 02:22:41 PM
1) I see no mention about new paging.php class ;)
2) cat_id=0 will only be showed when u access homepage - that is normal
3) lets fix first the original code then u can play with home.html and such ;)
4) see no {cat_paging_stats} which beliver or not could help too ;)
Title: Re: [MOD] limited number of categories per page
Post by: iraklis on August 11, 2005, 02:53:08 PM
1) I see no mention about new paging.php class ;)
2) cat_id=0 will only be showed when u access homepage - that is normal
3) lets fix first the original code then u can play with home.html and such ;)
4) see no {cat_paging_stats} which beliver or not could help too ;)

1) ok and paging.php is uploaded  :mrgreen:
2) you know what i mean with cat_id, if i hover the link to cat_page number "2"
3) yes, but why i cannot see the {cat_paging} and {cat_paging_stats}  if just include it in categories.html, that's the reason why i modify the home.html
4) ok now it's {cat_paging} and {cat_paging_stats} included in categories.html and excluded in home.html, now i've the problem (see above)
Title: Re: [MOD] limited number of categories per page
Post by: V@no on August 11, 2005, 02:59:16 PM
I'm running out of ideas...
can I see it in action? (PM me if u dont want publish your site url)
Title: Problem with cache function unsing this MOD
Post by: Tiburon on September 02, 2005, 02:05:24 PM
When I use the cache function of the script I get a problem with this mod.

It caches first site of my categories but then I can't get to page 2 or 3. Paging does not work anymore. Has anyone a solution for this ?
Title: Re: [MOD] limited number of categories per page
Post by: Jako on November 08, 2005, 05:08:37 PM
hi this is my site http://www.partymetropole.de/jako

i don´t know why all the catecogries are in one line

and the {cat_pagin} ist not shown

i set 2 categories per site but it does not work...
Title: Re: [MOD] limited number of categories per page
Post by: Jako on November 09, 2005, 05:38:26 PM
now it works

but i have another problem

how can i make it work for main categories

now it just works for the sub cats...
Title: Re: [MOD] limited number of categories per page
Post by: V@no on November 10, 2005, 12:09:38 AM
Do the same changes from Step 3 but in home.html template
Title: Re: [MOD] limited number of categories per page
Post by: cneal on January 23, 2006, 01:05:56 AM
i'm having trouble with cat_paging on home.html. i only want to display 9 categories...which i can do, the problem is being able to go to the next page of categories. when i click on page 2 for example, the link reads : http://www.mysite.com/gallery/categories.php?cat_id=0&sessionid=abf5e1a9bf52a1d3a08cda51b1228f8f&cat_page=2 

but i am transfered back to index.php.

my paging works fine within the categories.
Title: Re: [MOD] limited number of categories per page
Post by: V@no on January 23, 2006, 03:02:28 AM
In index.php below <?php insert:
Code: [Select]
$indexphp = 1;Then in includes/functions.php find:
Code: [Select]
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);Insert above:
Code: [Select]
global $indexphp;
if (isset($indexphp) && $indexphp == 1)
  $link_arg = $site_sess->url(ROOT_PATH."index.php");
else
Title: Re: [MOD] limited number of categories per page
Post by: cneal on January 23, 2006, 05:10:13 AM
it didn't work.

i inserted
$indexphp;
below <?php in index.php

and i couldn't find: $link_arg = ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id;

i did find: $link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);

so my code reads:
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);
global $indexphp;
if (isset($indexphp))
{
  $link_arg = ROOT_PATH."index.php";
}
Title: Re: [MOD] limited number of categories per page
Post by: V@no on January 23, 2006, 05:23:41 AM
Ok, try again, I've udated the code above (including the line in index.php)
Title: Re: [MOD] limited number of categories per page
Post by: Eagle Eye on April 25, 2006, 10:52:55 AM
Thanks for this great MOD, just tried it, unfortunately no errors, but no category displayed all.... its empty on home.html and catagory.html

I was interested to apply this mod to only the subcategory and leave the main category as default.... is it possible?
and also wanted to apply this mod on the sub-category page (leaving the home page as normal)

:?:
Title: Re: [MOD] limited number of categories per page
Post by: Stoleti on April 25, 2006, 07:46:37 PM
i've made 4 categories:

1,9,28,29

1 and 9 category works fine but 28 and 29 give me this error:

Quote
Fatal error: Cannot redeclare class paging in /home/blacktra/public_html/includes/paging.php on line 28

But inside this categories i've added subcategories, and them work fine, what need i do to fix it ?
Title: Re: [MOD] limited number of categories per page
Post by: V@no on April 26, 2006, 12:05:44 AM
did you miss Step 2?
Title: Re: Problem with cache function unsing this MOD
Post by: aletapety on June 07, 2006, 08:31:27 AM
When I use the cache function of the script I get a problem with this mod.

It caches first site of my categories but then I can't get to page 2 or 3. Paging does not work anymore. Has anyone a solution for this ?

I have the same problem  :?
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 07, 2006, 03:41:13 PM
Not tested:

In categories.php find:
Code: [Select]
    isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
Insert above:
Code: [Select]
    isset($HTTP_GET_VARS['cat_page']) ? $HTTP_GET_VARS['cat_page'] : 0,
Title: Re: [MOD] limited number of categories per page
Post by: aletapety on June 07, 2006, 08:10:59 PM
Yes V@no you are the best  8O solved ! but the same action we mast do in index.php and that all, thank ! ,now work when cache is enable  :wink:
Title: Re: [MOD] limited number of categories per page
Post by: V@no on June 08, 2006, 02:07:33 AM
Alright then, I've added Step 4 that fixes this issue :)
thanks for getting back with the result ;)
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: magaxine on August 04, 2006, 08:24:28 PM
really good mod, but unfortunately it doesn't work at my website. I tried several times to add it at my gallery, but I every time get this error-message at top of categoeries.php:

Warning: Division by zero in /www/htdocs/v093029/partypics/includes/functions.php on line 966

do you have an idea what could be the problem?
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: V@no on August 04, 2006, 08:46:55 PM
I have no idea what is on line 966 in your functions.php...
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: magaxine on August 05, 2006, 07:15:01 AM
I think the problem was that the line
foreach ($visible_cat_cache as $key => $category_id) {
appears two times in the code, I online replaced the first one.

now the "division by zero" error is fixed, but my categories-page shows not one gallery. here is the code of my functions.php, would be great if you could help me!
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: V@no on August 05, 2006, 10:02:06 AM
That line must be inside get_categories function
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: magaxine on August 05, 2006, 07:17:01 PM
hi v@no, sorry if I get on your nerves with my problem ;) but it just doesn't work. when I replace just the line

foreach ($visible_cat_cache as $key => $category_id) {
with
foreach ($cache as $category_id){

in the get_categories function, the "division by zero" error appears again. I just tried for 2 hours to get a solution, but I have no idea what the problem is  :roll:
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: V@no on August 05, 2006, 07:35:02 PM
There is no any division in the mod, so I need to know what is on your 966 line.
Or even better, please show what is on 966 line plus 10 lines above and below it.
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: magaxine on August 05, 2006, 08:33:31 PM
thx for your helb v@no  :D

here is the code:

956  $categories .= "</table></td>\n";
957      $categories .= "<td valign=\"top\" width=\"".$cattable_width."\" class=\"catbgcolor\">\n";
958      $categories .= "<table border=\"0\" cellpadding=\"".$config['cat_table_cellpadding']."\" cellspacing=\"".$config['cat_table_cellspacing']."\">\n";
959
960      $total = $total - $count2;
961      $table_columns = $table_columns - 1;
962      if ($total <= $table_columns && $table_columns > 1) {
963        $table_rows = 1;
964      }
965      else {
966        $table_rows = $total / $table_columns;
967        if ($total >= $table_columns && !is_integer($table_rows)) {
968          $table_rows = intval($table_rows) + 1;
969        }
970      }
971      $count = 0;
972    }
973  }
974
975  $categories .= "</table>\n</td>\n</tr>\n</table>\n";
976  return $categories;
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: V@no on August 06, 2006, 06:08:08 AM
are you using v1.7?
http://www.4homepages.de/forum/index.php?topic=6677.0
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: magaxine on August 06, 2006, 05:18:23 PM
Yes I use version 1.7, thx :) now I see 10 categories, but no paging, which means there is noch link to page 2,3,4...

I fell like an idiot because i got so much problems with your mod ;) but i got no idea what could be the problem. I added {cat_paging} to my categories.html and uploaded your version of paging.php, but nothing happens.
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: V@no on August 06, 2006, 10:24:52 PM
add it to home.html template as well
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: magaxine on August 06, 2006, 11:35:41 PM
thx, now I can see the paging. but unfortunately I got the same problem like some of the other users, I can't go to any of the other pages, beause the links are incorrect:

domain/categories.php?cat_id=0&cat_page=2

 [1]  2  3  4  5  ...  »  Last Page » Go to page:   
Found 97 categories on 10 page(s). Displayed category 1 to 10

even if I try do copy the URL and paste it directly in my browser with a correct cat_id is is impossible to view any of the other pages
Title: Re: [MOD] limited number of categories per page (updated 07-06-2006)
Post by: V@no on August 07, 2006, 01:27:28 AM
ok, replace in functions.php
Code: [Select]
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);
with:
Code: [Select]
$link_arg = $site_sess->url(ROOT_PATH.($cat_id ? "categories.php?".URL_CAT_ID."=".$cat_id : "index.php"));
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: magaxine on August 07, 2006, 01:22:15 PM
v@no, can't thank you enough for your help! now everything works perfectly!  :mrgreen:
great mod and great support, what more can you ask for!  :D
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: peti on September 18, 2007, 04:51:21 PM
hi i woud like to see the new paging.php file since i can't download it from the link.
Ty very much.
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: mawenzi on September 18, 2007, 05:11:02 PM
@peti
... the [MOD] Universal Paging Class v1.1 (the new paging.php) you can find here ...
http://www.4homepages.de/forum/index.php?topic=6926.0
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: navyseal on April 05, 2008, 02:59:25 AM
Its not working with categories and sub categories...works one the images paging...using 1.7.6 :(
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: navyseal on April 05, 2008, 03:13:42 AM
oops..missed the last step..my bad...works all ok :)
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: cch on July 18, 2009, 09:30:54 PM
Hi V@no

I'm using v1.7.7 and have added all the code but I get a white page when I go to a Cat.

Thanks
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: V@no on July 18, 2009, 10:42:48 PM
Hi V@no

I'm using v1.7.7 and have added all the code but I get a white page when I go to a Cat.

Thanks
Restore backups and try install mod again. There must an error you've made.
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: cch on July 18, 2009, 11:13:17 PM
Restore backups and try install mod again. There must an error you've made.
Hi V@no

I get a white page when I enter this code:

Code: [Select]
//Begin configuration:

$perpage = 10; //how many categories per page
$cat_text = "Found {total_cat_images} categories on {total_pages} page(s). Displayed category {first_page} to {last_page}";

//u can use those tags:
//{total_cat_images} - total categories
//{total_pages} - total pages
//{first_page} - displayed from (number first category displayed)
//{last_page} - displayed to (number last category displayed)
//End configuration

$page = (isset($HTTP_GET_VARS['cat_page'])) ? $HTTP_GET_VARS['cat_page'] : 0;
if (!class_exists("Paging")) {
  include(ROOT_PATH.'includes/paging.php');
}
$link_arg = $site_sess->url(ROOT_PATH.($cat_id ? "categories.php?".URL_CAT_ID."=".$cat_id : "index.php"));
$getpaging = new Paging($page, $perpage, $total, $link_arg, $cat_text, "", "cat_page");
$offset = $getpaging->get_offset();
$limit = ($offset + $perpage > $total) ? $total : $offset + $perpage - 1;
$total = $limit - $offset;
$site_template->register_vars(array(
  "cat_paging" => $getpaging->get_paging(),
  "cat_paging_stats" => $getpaging->get_paging_stats()
));
$cache = array();
$i = 0;
foreach ($visible_cat_cache as $key => $category_id) {
  if ($i >= $offset && $i <= $limit) {
    $cache[] = $category_id;
    $cache_sql .= (($cache_sql != "") ? ", " : "").$category_id;
  }
  $i++;
}
$total = count($cache);

Also there a 2 lines with this code:

Code: [Select]
  $total = sizeof($visible_cat_cache);
I've tried after both lines and still get the white page???
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: V@no on July 18, 2009, 11:54:24 PM
In unmodified 4images there is only one such line.
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: cch on July 19, 2009, 12:09:16 AM
In unmodified 4images there is only one such line.
I given, I removed 1 line of that code added the main code again and still got a white page.
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: okey on August 22, 2009, 05:02:45 PM
In unmodified 4images there is only one such line.
I given, I removed 1 line of that code added the main code again and still got a white page.

We need to replace paging.php this file (http://www.4homepages.de/forum/index.php?action=dlattach;topic=6926.0;attach=997)
Try it should work
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: cch on December 02, 2009, 08:16:36 PM
Hi

I've added this to my new site and got the paging to show but my categories show like this:

(http://i49.tinypic.com/vnmrra.jpg)

But when this mod isn't added to my site the categories show in a list, the way they should, any ideas?

Thanks
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: V@nо on December 02, 2009, 09:22:54 PM
please show a screenshot how it supposed to look like.
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: cch on December 02, 2009, 09:48:07 PM
Sorted I missed Step 1.3 all is fine, thank you for a great Mod
Title: Re: [MOD] limited number of categories per page
Post by: allister on September 06, 2010, 09:47:06 AM
Hey V@no thanks for the great MOD. Everything working perfectly just except one thing.

I just wanted to limit only the subcategories not the main categories on home  :(

appreciate your help on this one  :roll:

thanks again.
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: V@no on September 06, 2010, 04:33:38 PM
Find:
$perpage = 10; //how many categories per page

Insert below :below::
if (!$cat_id) $perpage = $total; //show all on home page;
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: allister on September 06, 2010, 06:30:20 PM
thanks a million V@no  :D
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: yousaf on March 06, 2012, 02:17:12 PM
@Vano

Does this Mod works on 1.7.10?
and
Does it works stand alone on 1.7.10 or i will have to add the other Mod for Cache ([MOD] Cache System for 4images v1.7)?

as i just applied this Mod's steps on a fresh copy of 1.7.10 and i can see the pagination but there are no categories
Please check the snapshot in attachment

Edit: [I thought i am just facing this issue on 1.7.10 but a fresh 1.7.6 gives the same result.]
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: Jan-Lukas on March 06, 2012, 07:30:07 PM
gerade getestet, klappt auch in der 1.7.10
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: yousaf on March 06, 2012, 07:32:28 PM
gerade getestet, klappt auch in der 1.7.10

English please, sorry i dont understand German Language :(
Title: Re: [MOD] limited number of categories per page (updated 08-06-2006)
Post by: yousaf on March 13, 2012, 10:50:56 AM
Help any body!
i am unable to make it work even on 1.7.4

what am i missing anyway

[Edit]

Never mind I figured it out my self somehow after banging my head into keyboard
IF you face a situation like i did(please read my above post) then

In Step 1.3 you will get two results for

Code: [Select]
foreach ($visible_cat_cache as $key => $category_id) {
so dont change the first one but just replace the 2nd result with Code below:

Code: [Select]
foreach ($cache as $category_id){