4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started 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:global $site_template, $site_db, $site_sess, $config, $lang;
Replace with:global $site_template, $site_db, $site_sess, $config, $lang, $HTTP_GET_VARS;
Step 1.2. (updated 05-27-03)
Find: $total = sizeof($visible_cat_cache);
Add after://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:foreach ($visible_cat_cache as $key => $category_id) {
Replace with: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: isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
Insert above: isset($HTTP_GET_VARS['cat_page']) ? intval($HTTP_GET_VARS['cat_page']) : 0,
-
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
$table_rows = $total / $table_columns;
-
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:if ($total <= $table_columns) {
with:if ($total <= $table_columns || !$table_columns) {
but this is not supposed to be like that...
-
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.
-
Step 1.2.
Find:$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.
$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.
-
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.
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
-
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 :?:
-
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.)
-
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:foreach ($visible_cat_cache as $key => $category_id) {
if ($key >= $offset && $key <= $limit) {
$cache[] = $category_id;
}
}
replace with:$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)
-
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
$total = sizeof($visible_cat_cache);
in functions.php to
$total = count($visible_cat_cache);
-
Does this mean that we should change all the
$total = sizeof($visible_cat_cache);
in functions.php to
$total = count($visible_cat_cache);
wont hurt ;)
-
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
-
you can visit: http://idols-unlimited.com to see this.
where exactly is it? I couldnt find any paging there...
-
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 ! :(
-
below this line:
$page = (isset($HTTP_GET_VARS['cat_page'])) ? $HTTP_GET_VARS['cat_page'] : 0;
Insert:echo $page;
Then go to second or third page and see what number it shows.
-
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 :?
-
make sure u did step 2
-
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:
-
can I see it?
-
Yep !
http://www.hintergrundbilder.de/wallpaper/categories.php?cat_id=1
-
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.
-
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.
-
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
-
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.
-
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.
-
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.
<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
-
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:$getpaging = new Paging($page, $perpage, $total, $link_arg, "cat_page", $cat_text);
with this:$getpaging = new Paging($page, $perpage, $total, $link_arg, $cat_text, "", "cat_page");
-
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 :) :) :)
-
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
-
omg....huh? :?
wierd...replace total_something with total_cat_images
or redo Step 1.2, its fixed now.
-
V@no,
Everything fixed.
:D Thanks again...
Loet
-
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.?
-
sorry, I dont think I understand your question.
This mod should affect home page as well as categories page....
-
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
-
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 ?
-
cat_page, i think i head also page, but i'm not shure. what's the wright one?
-
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?
-
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 $total = count($visible_cat_cache);
it was supposed to be $total = sizeof($visible_cat_cache);
(the original post updated)
-
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;
-
4images is fully based on superglobals, so it's this one :
global $site_template, $site_db, $site_sess, $config, $lang, $HTTP_GET_VARS;
;)
-
that isn't the problem. but what i found out:
with
foreach ($visible_cat_cache as $key => $category_id) {
it works and i see the categories, limited by the script.
with
foreach ($cache as $category_id){
i can't see the categories
-
i can't see the categories
Correct. It has to stay with the $visible_cat_cache.
-
Correct. It has to stay with the $visible_cat_cache.
so why is in the manual step 1.3 written,
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
$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
-
Perhaps I missed something regarding this functionality but
replace :
foreach ($cache as $category_id){
with :
foreach ($visible_cat_cache as $category_id){
-
like you can see in the code, it is already done.
-
could someone send me his "funktion.php" ??? :mrgreen:
-
foreach ($visible_cat_cache as $key => $category_id) {
That is the original coding.
The instructions says :
foreach ($cache as $category_id) {
And now, replace it with :
foreach ($visible_cat_cache as $category_id) {
-
foreach ($visible_cat_cache as $key => $category_id) {
That is the original coding.
The instructions says :
foreach ($cache as $category_id) {
And now, replace it with :
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:function get_categories($cat_id = 0) {
and ended with:function get_category_path($cat_id = 0, $detail_path = 0) {
-
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;
}
-
FYI
i also add this mod
http://www.4homepages.de/forum/index.php?topic=6675
but this souldn't disturb this one !?
-
i also add this mod
Ah ! this wasn't mentionned first. ;)
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.
-
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
-
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. ;)
-
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 if ($categories && function_exists('get_subcategories') && $num_images >= 1) {
condition. (I dont know where this came from)
What happens if you insert above:$total = sizeof($visible_cat_cache);
this:echo $cat_id."<br />";
The idea it should show u the category id on top of the page.
-
it's 0
like the url: domain/categories.php?cat_id=0&cat_page=4
-
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
-
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
-
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!?
-
FYI
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.
-
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.
-
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.
-
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
-
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!!!
-
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) 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)
-
I'm running out of ideas...
can I see it in action? (PM me if u dont want publish your site url)
-
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 ?
-
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...
-
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...
-
Do the same changes from Step 3 but in home.html template
-
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.
-
In index.php below <?php insert:
$indexphp = 1;
Then in includes/functions.php find:$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);
Insert above:global $indexphp;
if (isset($indexphp) && $indexphp == 1)
$link_arg = $site_sess->url(ROOT_PATH."index.php");
else
-
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";
}
-
Ok, try again, I've udated the code above (including the line in index.php)
-
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)
:?:
-
i've made 4 categories:
1,9,28,29
1 and 9 category works fine but 28 and 29 give me this error:
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 ?
-
did you miss Step 2?
-
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 :?
-
Not tested:
In categories.php find: isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
Insert above: isset($HTTP_GET_VARS['cat_page']) ? $HTTP_GET_VARS['cat_page'] : 0,
-
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:
-
Alright then, I've added Step 4 that fixes this issue :)
thanks for getting back with the result ;)
-
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?
-
I have no idea what is on line 966 in your functions.php...
-
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!
-
That line must be inside get_categories function
-
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:
-
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.
-
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;
-
are you using v1.7?
http://www.4homepages.de/forum/index.php?topic=6677.0
-
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.
-
add it to home.html template as well
-
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
-
ok, replace in functions.php
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);
with:$link_arg = $site_sess->url(ROOT_PATH.($cat_id ? "categories.php?".URL_CAT_ID."=".$cat_id : "index.php"));
-
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
-
hi i woud like to see the new paging.php file since i can't download it from the link.
Ty very much.
-
@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
-
Its not working with categories and sub categories...works one the images paging...using 1.7.6 :(
-
oops..missed the last step..my bad...works all ok :)
-
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
-
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.
-
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:
//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:
$total = sizeof($visible_cat_cache);
I've tried after both lines and still get the white page???
-
In unmodified 4images there is only one such line.
-
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.
-
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
-
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
-
please show a screenshot how it supposed to look like.
-
Sorted I missed Step 1.3 all is fine, thank you for a great Mod
-
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.
-
Find:
$perpage = 10; //how many categories per page
Insert below :below::
if (!$cat_id) $perpage = $total; //show all on home page;
-
thanks a million V@no :D
-
@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.]
-
gerade getestet, klappt auch in der 1.7.10
-
gerade getestet, klappt auch in der 1.7.10
English please, sorry i dont understand German Language :(
-
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
foreach ($visible_cat_cache as $key => $category_id) {
so dont change the first one but just replace the 2nd result with Code below:
foreach ($cache as $category_id){