4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on May 23, 2003, 03:07:58 PM

Title: [MOD] Paging for comments
Post by: V@no on May 23, 2003, 03:07:58 PM
This MOD will add Paging to comments, that means it will display only XX number of comments per page, just like in categories.php ( u probably have seen this already: http://gallery.vano.org/7570 )
Also, this MOD fix some problem, when u have extra fields in USERS_TABLE in the database (for example if u added new fields for Yahoo ID, signature) and want display it in comments too (by default u can not show value of those fields in comments. Reference (http://www.4homepages.de/forum/viewtopic.php?t=3379)).


------------ Changes in following files: -------------
/details.php
/lang/<yourlanguage>/main.php
/templates/<yourtemplate>/details.html


------------ New template: --------------
/template/<yourtemplate>/commentsperpage_dropdown_form.html


-----------| Installation |-------------

Step 1.
Open /details.php
Find:
Code: [Select]
if ($image_allow_comments == 1) {
Insert below:
Code: [Select]
  if (isset($HTTP_POST_VARS['commentsetperpage']) || isset($HTTP_GET_VARS['commentsetperpage'])) {
    $commentsetperpage = (intval($HTTP_POST_VARS['commentsetperpage']) ) ? intval($HTTP_POST_VARS['commentsetperpage']) : intval($HTTP_GET_VARS['commentsetperpage']);
    if ($commentsetperpage) {
      $site_sess->set_session_var("commentperpage", $commentsetperpage);
      $session_info['commentperpage'] = $commentsetperpage;
    }
  }

  if (isset($session_info['commentperpage'])) {
    $commentperpage = $session_info['commentperpage'];
  }
  else {
    $commentperpage = 5;
  }
  $commentsperpage_dropdown = "\n<select name=\"commentsetperpage\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['commentsperpage'].submit() }\" class=\"select\">\n";
  for($i = 1; $i <= 15; $i++) {
    $setvalue = 1 * $i;
    $commentsperpage_dropdown .= "<option value=\"".$setvalue."\"";
      if ($setvalue == $commentperpage) {
      $commentsperpage_dropdown .= " selected=\"selected\"";
    }
    $commentsperpage_dropdown .= ">";
    $commentsperpage_dropdown .= $setvalue;
    $commentsperpage_dropdown .= "</option>\n";
  }
  $commentsperpage_dropdown .= "</select>\n";

  $site_template->register_vars("commentsperpage_dropdown", $commentsperpage_dropdown);
  $commentsperpage_dropdown_form = $site_template->parse_template("commentsperpage_dropdown_form");
  $site_template->register_vars("commentsperpage_dropdown_form", $commentsperpage_dropdown_form);

  $sql = "SELECT COUNT(image_id) AS comments
          FROM ".COMMENTS_TABLE."
          WHERE image_id = $image_id";
  $result = $site_db->query_firstrow($sql);
  $site_db->free_result();
  $num_comments = $result['comments'];
  if ($action == "postcomment") {
    $page = ceil($num_comments / $commentperpage);
  }
  $num_rows_all = (isset($num_comments)) ? $num_comments : 0;
  $link_arg = $site_sess->url(ROOT_PATH."details.php?image_id=$image_id");
  include(ROOT_PATH.'includes/paging.php');
  $getpaging = new Paging($page, $commentperpage, $num_rows_all, $link_arg, $lang['comment_stats'], "comments");
  $offset = $getpaging->get_offset();
  $site_template->register_vars(array(
    "paging" => $getpaging->get_paging(),
    "paging_stats" => ($num_comments) ? $getpaging->get_paging_stats() : ""
  ));
  $additional_sql = "";
  if (!empty($additional_user_fields)) {
    $table_fields = $site_db->get_table_fields(USERS_TABLE);
    foreach ($additional_user_fields as $key => $val) {
      if (isset($table_fields[$key])) {
        $additional_sql .= ", u.$key";
      }
    }
  }

Step 1.1. added 5-27-03
Find:
Code: [Select]
       "comment_id" => $comment_row[$i]['comment_id'],Add after:
Code: [Select]
"lang_comments_per_page" => $lang['comments_per_page'],
Step 1.2 added 2009-08-12
Find:
Code: [Select]
          ORDER BY c.comment_date ASCReplace it with:
Code: [Select]
          ORDER BY c.comment_date ASC
          LIMIT $offset, $commentperpage";


Step 2.
Open /lang/<yourlanguage>/main.php
Add just before closing ?>
Code: [Select]
$lang['comment_stats'] = "Found: {total_cat_images} comment(s) on {total_pages} page(s). Displayed: comment {first_page} to {last_page}.";
$lang['comments_per_page'] = "Comments per page:";


Step 3.
Open /templates/<yourtemplate>/details.html
Find:
Code: [Select]
{if allow_comments}Add after:
Code: [Select]
<a name="comments"></a>
{if paging_stats}
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="bordercolor">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="row1" valign="middle">
{paging_stats}
</td>
<td class="row1" valign="top" align="right">
{commentsperpage_dropdown_form}
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
{endif paging_stats}
{if paging}
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="bordercolor">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="row1" valign="top">{paging}</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
{endif paging}


Step 4.
Create new template /templates/<yourtemplate>/commentsperpage_dropdown_form.html with this code:
Code: [Select]
<table border="0" cellspacing="0" cellpadding="0">
<form method="post" action="{self}#comments" name="commentsperpage">
<tr>
<td>{lang_comments_per_page}&nbsp;</td>
<td>{commentsperpage_dropdown}</td>
</tr>
</form>
</table>


Step 5.
Make sure that u have new Universal Paging Class (http://www.4homepages.de/forum/index.php?topic=5761).
This MOD will work with default paging.php, but will display
Quote
Found 5 Imag(s) on 1 page(s). Dispalayed Image 1 to 5

Step 6
For 4images v1.7.1 Apply this patch:
http://www.4homepages.de/forum/index.php?topic=7493.0
Title: [MOD] Paging for comments
Post by: Xwall on May 23, 2003, 10:06:32 PM
Excellent MOD :wink:
Title: [MOD] Paging for comments
Post by: toto1 on May 24, 2003, 05:21:19 AM
Veno the best  :D  :D
Title: Re: [MOD] Paging for comments
Post by: ID25 on August 08, 2005, 07:51:22 PM
What i can change to DECCENDING those comments?
At now Accending, very bad :/
users can't read new comments... need to click next, next, next....
Title: Re: [MOD] Paging for comments
Post by: Vincent on August 08, 2005, 08:09:14 PM
Hello v@no

paging system is allright but i would like to use the paging system with this MOD
http://www.4homepages.de/forum/index.php?topic=7848.30

and i would like to add this paging system here
http://www.foto-kocher.com/soldpubl.php

sincerly
vincent
Title: Re: [MOD] Paging for comments
Post by: ID25 on August 14, 2005, 03:55:02 AM
There is better thing:
Code: [Select]
for($i = 1; $i <= 20; $i++) {
$setvalue = 5 * $i;

for the paging 5,10,15,20......,95,100
Title: Re: [MOD] Paging for comments
Post by: ID25 on August 15, 2005, 10:21:14 PM
And there is small bug:
 when no comments, paging numbers i see, but "Comments per page:" for this - not shown
Title: Re: [MOD] Paging for comments
Post by: V@no on August 15, 2005, 11:55:19 PM
There is better thing:
Code: [Select]
for($i = 1; $i <= 20; $i++) {
$setvalue = 5 * $i;

for the paging 5,10,15,20......,95,100
Have no clue what u ment by that

And there is small bug:
 when no comments, paging numbers i see, but "Comments per page:" for this - not shown
you see paging numbers (links to page 2, 3, 4, etc) when no comments at all? and in the same time, when no comments to display it doesnt show you comments per page dropdown?
Title: Re: [MOD] Paging for comments
Post by: ID25 on August 16, 2005, 12:31:24 AM
if you dont want to see number 1,2,3,4,5,6,7........1000
modify to this:
Quote
for($i = 1; $i <= 20; $i++) {
$setvalue = 5 * $i;

after this you see:
5,10,15,20,25......100
Title: Re: [MOD] Paging for comments
Post by: ID25 on August 16, 2005, 12:34:49 AM
Quote
you see paging numbers (links to page 2, 3, 4, etc) when no comments at all? and in the same time, when no comments to display it doesnt show you comments per page dropdown?

i see paging numbers (links to page 2, 3, 4, etc) when no comments at all
and not see language near this "Comments per page:"

4images 1.7
Title: Re: [MOD] Paging for comments
Post by: Josef Florian on August 21, 2005, 06:49:51 PM
Das ist ein netter Mod! Nur wie kann man folgendes noch dazu einstellen damit immer die letzten Kommentare sichtbar sind? Also die letzte Kommentarseite des ausgewählten Bildes?
Title: Re: [MOD] Paging for comments
Post by: ID25 on August 28, 2005, 07:00:37 PM
ex: with "Opera" this feature not working automaticaly when chosing "comments per page"...
commentsperpage_dropdown_form.html must be with button:
Code: [Select]
<table border="0" cellspacing="0" cellpadding="0">
<form method="post" action="{self}#comments" name="commentsperpage">
<tr>
<td>{lang_comments_per_page}&nbsp;</td>
<td>{commentsperpage_dropdown}</td>
      <td valign="top">
        <input type="submit" value="{lang_go}" class="button" />
      </td>
</tr>
</form>
</table>
Title: Re: [MOD] Paging for comments
Post by: beseech on September 15, 2005, 06:33:53 PM
i've a lil doubt ... i want install it but...i've this modified (1 step) cuz the mod (member personal pic) so i'e this

Code: [Select]
if ($image_allow_comments == 1) {
  $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").", u.userpic
          FROM ".COMMENTS_TABLE." c
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.image_id = $image_id
          ORDER BY c.comment_date ASC";
  $result = $site_db->query($sql);


if i replace for

Code: [Select]
if (isset($session_info['commentperpage'])) {
$commentperpage = $session_info['commentperpage'];
}
else {
$commentperpage = 5;
}
$commentsperpage_dropdown = "\n<select name=\"commentsetperpage\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['commentsperpage'].submit() }\" class=\"select\">\n";
for($i = 1; $i <= 15; $i++) {
$setvalue = 1 * $i;
$commentsperpage_dropdown .= "<option value=\"".$setvalue."\"";
   if ($setvalue == $commentperpage) {
   $commentsperpage_dropdown .= " selected=\"selected\"";
}
$commentsperpage_dropdown .= ">";
$commentsperpage_dropdown .= $setvalue;
$commentsperpage_dropdown .= "</option>\n";
}
$commentsperpage_dropdown .= "</select>\n";

$site_template->register_vars("commentsperpage_dropdown", $commentsperpage_dropdown);
$commentsperpage_dropdown_form = $site_template->parse_template("commentsperpage_dropdown_form");
$site_template->register_vars("commentsperpage_dropdown_form", $commentsperpage_dropdown_form);

 $sql = "SELECT COUNT(image_id) AS comments
     FROM ".COMMENTS_TABLE."
     WHERE image_id = $image_id";
$result = $site_db->query_firstrow($sql);
$site_db->free_result();
$num_comments = $result['comments'];
if ($action == "postcomment") {
$page = ceil($num_comments / $commentperpage);
}
$num_rows_all = (isset($num_comments)) ? $num_comments : 0;
$link_arg = $site_sess->url(ROOT_PATH."details.php?image_id=$image_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $commentperpage, $num_rows_all, $link_arg, $lang['comment_stats'], "comments");
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => ($num_comments) ? $getpaging->get_paging_stats() : ""
));
 $additional_sql = "";
 if (!empty($additional_user_fields)) {
   $table_fields = $site_db->get_table_fields(USERS_TABLE);
   foreach ($additional_user_fields as $key => $val) {
     if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
       $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
     }
   }
 }
 $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
         FROM ".COMMENTS_TABLE." c
         LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
         WHERE c.image_id = $image_id
         ORDER BY c.comment_date ASC
         LIMIT $offset, $commentperpage";
 $result = $site_db->query($sql);

i will del the ".userpic" , so the question is :

How can i install it without del ".userpic" ???
Title: Re: [MOD] Paging for comments
Post by: Joss on January 03, 2006, 02:41:04 PM
I've a problem with this MOD.

I've installed Universal Paging Class v1.1 and this MOD, but in my gallery comments looks like:

...
{if paging_stats}
Found: 19 comment(s) on 4 page(s). Displayed: comment 11 to 15.    

{endif paging_stats} {if paging}
« First page  «  1  2  [3]  4  »  Last page » Go to page:

{endif paging}
...

Is there my mistake in my code? Pls, help me and sorry for my English, I'm from Russia.


Title: Re: [MOD] Paging for comments
Post by: V@no on January 03, 2006, 02:43:04 PM
try this: http://www.4homepages.de/forum/index.php?topic=7493.0
Title: Re: [MOD] Paging for comments
Post by: Joss on January 03, 2006, 02:55:05 PM
Thank you very much, Vano!
I think, may be to move this link to the start of this topic?
Title: Re: [MOD] Paging for comments
Post by: Aleksey on January 15, 2006, 02:54:44 AM
how do then open photo,
automatic open last page comments?
Title: Re: [MOD] Paging for comments
Post by: Aleksey on January 16, 2006, 09:01:54 PM
up...
Title: Re: [MOD] Paging for comments
Post by: V@no on January 17, 2006, 12:53:56 AM
If you can answer this question...how would you open the first page of comments, if when you open the page without page=xx in the url it will open the last page? (no page=xx in the url is eaqual to page=1)
If you have an idea on how to make it work, then we'll talk ;)
Title: Re: [MOD] Paging for comments
Post by: V@no on January 17, 2006, 01:06:35 AM
Ok, I'll answer it for you ;)
In details.php replace
Code: [Select]
 if ($action == "postcomment") {with this:
Code: [Select]
 if (isset($HTTP_GET_VARS[URL_PAGE]) || isset($HTTP_POST_VARS[URL_PAGE])) {
    $page = (isset($HTTP_POST_VARS[URL_PAGE])) ? intval($HTTP_POST_VARS[URL_PAGE]) : intval($HTTP_GET_VARS[URL_PAGE]);
    if (!$page) {
      $page = 0;
    }
  }
  else {
    $page = 0;
  }
  if (!$page || $action == "postcomment") {

P.S. I like this idea of yours ;)
Title: Re: [MOD] Paging for comments
Post by: Aleksey on January 18, 2006, 01:09:08 AM
YES! YES! YES! This work! Thank you very much Vano!  You super coder :mrgreen:
В общем спасибо большое :) Это самое правильное дополнение к этому хаку, иначе людям приходится постоянно жать последнюю страницу чтобы посмотреть нет ли новых сообщений :)
Title: Re: [MOD] Paging for comments
Post by: IcEcReaM on January 25, 2006, 07:01:19 PM
Das ist ein netter Mod! Nur wie kann man folgendes noch dazu einstellen damit immer die letzten Kommentare sichtbar sind? Also die letzte Kommentarseite des ausgewählten Bildes?

Du kannst die Sortierreihenfolge umstellen.

I have made a little change,
so it will not display from oldest to newest.
I think to change the order from ascending to descending is better,
so u see the latest comments always on the first site.

Search
Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
         FROM ".COMMENTS_TABLE." c
         LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
         WHERE c.image_id = $image_id
         ORDER BY c.comment_date ASC
         LIMIT $offset, $commentperpage";

and replace with
Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
         FROM ".COMMENTS_TABLE." c
         LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
         WHERE c.image_id = $image_id
         ORDER BY c.comment_date DESC
         LIMIT $offset, $commentperpage";

The only change is the changed order from ASC to DESC.
Title: Re: [MOD] Paging for comments
Post by: V@no on January 26, 2006, 12:21:12 AM
I have made a little change,
so it will not display from oldest to newest.
I think to change the order from ascending to descending is better,
so u see the latest comments always on the first site.
Yes, you are right, its better that way. Thanks. I've updated the original code too ;)
Title: Re: [MOD] Paging for comments
Post by: mawenzi on January 26, 2006, 12:36:53 AM
Yes, you are right, its better that way. Thanks. I've updated the original code too ;)

... mmm ... but not at the right place (new paging code) ...  :wink:
Title: Re: [MOD] Paging for comments
Post by: V@no on January 26, 2006, 02:39:46 AM
ahaha, I'm an idiot :oops:
good save ;) thanks
Title: Re: [MOD] Paging for comments
Post by: insane on January 29, 2006, 07:35:58 PM
hi, i've got a big problem, hope anyone is able to help me

first of all i made a test account in my gallery

www.p4ddy-online.de.vu/4images
name: test password: test

so that u can take a look on this problem.
when u click on a thumbnail u won't get the big version of the photo and the comments below - it looks like the page is just refreshing and do not link u to the next page (photo+comments)

how can i fix this problem? (we came to the solution that this problem has come by installing this mod http://www.4homepages.de/forum/index.php?topic=11371.0)

please help, other wise my gallery suxX -.- (anyway)

greetz (again sorry about my english..)
Title: Re: [MOD] Paging for comments
Post by: V@no on January 29, 2006, 08:12:23 PM
Here is a tip:
never install more the one mod at a time. Install only one, test the gallery in every possible ways, make sure it works properly, then continue with another mod. Acording to the problems you've had recently, you are installing everything at once and then test it and if something goes wrong you dont know where to look at, because you dont know what modifications could possible caused it.
So, my advice to you is start over and do it the proper way, with backups for each change you make.
I'm not going even bother to guess what possible could be wrong there.

Good luck.
Title: Re: [MOD] Paging for comments
Post by: insane on January 29, 2006, 08:15:47 PM
ok my nightmare became reality ;P
can i reset everything without deleting my pics and comments?
(just keep the data folder there) does it work?
Title: Re: [MOD] Paging for comments
Post by: V@no on January 29, 2006, 08:35:32 PM
Yes, simply replacing all .php files with fresh ones should not break your gallery, yet, you will loose all the installed mods/changes you've made (obviously), but again, backup the current files before you replace them!

P.S. personaly I hate making backups, but, using UltraEdit (http://www.ultraedit.com/index.php?name=Content&pa=showpage&pid=10) and with help of this (http://www.ultraedit.com/index.php?name=Forums&file=viewtopic&p=2987#2987) little trick let me do backups by pressing two keys :)
Title: Re: [MOD] Paging for comments
Post by: TheOracle on January 29, 2006, 08:41:46 PM
Quote

P.S. personaly I hate making backups, but, using UltraEdit and with help of this little trick let me do backups by pressing two keys


In addition, there's always Winmerge (which is free) so you could compare and make the proper codings replacement without affecting your gallery. ;)
Title: Re: [MOD] Paging for comments
Post by: insane on January 29, 2006, 11:22:20 PM
shit but the users and comments will be lost, won't they?
Title: Re: [MOD] Paging for comments
Post by: V@no on January 30, 2006, 12:22:33 AM
users, images, categories, comments, etc stays in the database, you are replacing the code, not the data.
Title: Re: [MOD] Paging for comments
Post by: Flatermann on February 12, 2006, 01:31:58 PM
I thout to post a slight change i made on the code.
The reason for this change was that my users all  had a difrent thinking of how many comment per page they what to see. yeah i know they can user the pulldown menue but that wasnt anought LOL .
The thing i did is to put a inputfield in the users controllcenter that they can give in how many comments they want to see per page.
I thout maybe someone would be intressed in this change. Hope i dont get someone made abaut it :(

NEVER forget to backup all files and databank befor doing changes.

add this in ( includes/db_field_definitions.php )
Code: [Select]
$additional_user_fields['user_comments_perpage'] = array($lang['user_comments_perpage'], "text", 0);
in meber.php
sereach for
Code: [Select]
"lang_icq" => $lang['icq'],
insert under
Code: [Select]
"lang_comments_per_page_settings" => $lang['comments_per_page_settings'],
in you lang file main.php
sereach for
Code: [Select]
$lang['icq'] = "ICQ:";
insert under
Code: [Select]
$lang['comments_per_page_settings'] = "Comments per page:";
in member_editeprofile.html sereach for ( if you dont fid in code then ist because my class="cat2".  your could be deffernt so normalyou you can inser the code under any </tr> or above any <tr> depends on were you want to show the input field.
Code: [Select]
        <tr>
          <td class="cat2"><b>{lang_icq}</b></td>
          <td colspan="3" class="cat2"><input type="text" name="user_icq"  size="30" value="{user_icq}" class="input" /></td>
        </tr>

insert under
Code: [Select]
  <tr>
          <td class="cat2"><b>{lang_comments_per_page_settings}</b></td>
          <td colspan="3" class="cat2">
            <input type="text" name="user_comments_perpage"  size="30" value="{user_comments_perpage}" class="input" />
          </td>
        </tr>

in details.php

sereach for
Code: [Select]
$commentperpage = 5;
replace with
Code: [Select]
if ($user_info['user_level'] == GUEST) {
 $commentperpage = 5;
 }
 else {
  $commentperpage = $user_info['user_comments_perpage'];
 }

now you need to insert a new feld in tha table `4images_users` called  user_comments_perpage with a standard value 5 and Typ decimal

mabe oracle could post a easy way for users how to put in a new feld in the table.   :D :mrgreen:

Greetzzzz from Flatermann



Title: Re: [MOD] Paging for comments
Post by: glitzer on February 19, 2006, 07:10:45 PM
I have a problem here,
in my detail.php is the code:
Code: [Select]
if ($image_allow_comments == 1) {
$additional_sql = "";
  if (!empty($additional_user_fields)) {
    $table_fields = $site_db->get_table_fields(USERS_TABLE);
    foreach ($additional_user_fields as $key => $val) {
      if (isset($table_fields[$key])) {
        $additional_sql .= ", u.$key";
      }
    }
  }
  $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
          FROM ".COMMENTS_TABLE." c
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.image_id = $image_id
          ORDER BY c.comment_date ASC";
  $result = $site_db->query($sql);

How can i replace it with the code from here?
When i replace the code so i think its right..i cant see the avatars in the comments no more.
Title: Re: [MOD] Paging for comments
Post by: V@no on February 19, 2006, 07:17:52 PM
Perpahs it would be best if you show the code you "think its right" as well ;)
Title: Re: [MOD] Paging for comments
Post by: glitzer on February 19, 2006, 07:25:12 PM
 :D

Code: [Select]
if ($image_allow_comments == 1) {
$additional_sql = "";
  if (!empty($additional_user_fields)) {
    $table_fields = $site_db->get_table_fields(USERS_TABLE);
    foreach ($additional_user_fields as $key => $val) {
      if (isset($table_fields[$key])) {
        $additional_sql .= ", u.$key";
      }
    }
  }
 if (isset($HTTP_POST_VARS['commentsetperpage']) || isset($HTTP_GET_VARS['commentsetperpage'])) {
$commentsetperpage = (intval($HTTP_POST_VARS['commentsetperpage']) ) ? intval($HTTP_POST_VARS['commentsetperpage']) : intval($HTTP_GET_VARS['commentsetperpage']);
if ($commentsetperpage) {
   $site_sess->set_session_var("commentperpage", $commentsetperpage);
   $session_info['commentperpage'] = $commentsetperpage;
}
}

if (isset($session_info['commentperpage'])) {
$commentperpage = $session_info['commentperpage'];
}
else {
$commentperpage = 5;
}
$commentsperpage_dropdown = "\n<select name=\"commentsetperpage\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['commentsperpage'].submit() }\" class=\"select\">\n";
for($i = 1; $i <= 15; $i++) {
$setvalue = 1 * $i;
$commentsperpage_dropdown .= "<option value=\"".$setvalue."\"";
   if ($setvalue == $commentperpage) {
   $commentsperpage_dropdown .= " selected=\"selected\"";
}
$commentsperpage_dropdown .= ">";
$commentsperpage_dropdown .= $setvalue;
$commentsperpage_dropdown .= "</option>\n";
}
$commentsperpage_dropdown .= "</select>\n";

$site_template->register_vars("commentsperpage_dropdown", $commentsperpage_dropdown);
$commentsperpage_dropdown_form = $site_template->parse_template("commentsperpage_dropdown_form");
$site_template->register_vars("commentsperpage_dropdown_form", $commentsperpage_dropdown_form);

 $sql = "SELECT COUNT(image_id) AS comments
     FROM ".COMMENTS_TABLE."
     WHERE image_id = $image_id";
$result = $site_db->query_firstrow($sql);
$site_db->free_result();
$num_comments = $result['comments'];
if ($action == "postcomment") {
$page = ceil($num_comments / $commentperpage);
}
$num_rows_all = (isset($num_comments)) ? $num_comments : 0;
$link_arg = $site_sess->url(ROOT_PATH."details.php?image_id=$image_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $commentperpage, $num_rows_all, $link_arg, $lang['comment_stats'], "comments");
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => ($num_comments) ? $getpaging->get_paging_stats() : ""
));
 $additional_sql = "";
 if (!empty($additional_user_fields)) {
   $table_fields = $site_db->get_table_fields(USERS_TABLE);
   foreach ($additional_user_fields as $key => $val) {
     if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
       $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
     }
   }
 }
 $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
         FROM ".COMMENTS_TABLE." c
         LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
         WHERE c.image_id = $image_id
         ORDER BY c.comment_date DESC
         LIMIT $offset, $commentperpage";
 $result = $site_db->query($sql);

when i change the code to this..the paging for comments works great..but i cant see the avatars in the comments no more.
Title: Re: [MOD] Paging for comments
Post by: V@no on February 19, 2006, 07:33:41 PM
remove
Code: [Select]
$additional_sql = "";
if (!empty($additional_user_fields)) {
   $table_fields = $site_db->get_table_fields(USERS_TABLE);
   foreach ($additional_user_fields as $key => $val) {
     if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
       $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
     }
   }
}
Title: Re: [MOD] Paging for comments
Post by: glitzer on February 19, 2006, 07:39:28 PM
is doesnt help..perhaps its the second code of the details..what put my avatars away?

Here is my whole details.php without the code for the paging for comments..with this code i can see the avatars.. :)
Code: [Select]
removed
Title: Re: [MOD] Paging for comments
Post by: V@no on February 19, 2006, 07:47:30 PM
1) please do not post the code from entire file, but rename the file with .txt extension (or zip it) and attach to your reply.
2) please attach the modified file, not only the original.
Title: Re: [MOD] Paging for comments
Post by: glitzer on February 19, 2006, 07:50:49 PM
sorry v@no

ok here is my modified detail.php.

It works for the paging of comments..but the avatars in the comments are away.
thanks for help
Title: Re: [MOD] Paging for comments
Post by: V@no on February 19, 2006, 07:57:06 PM
You removed different block then I showed above...yet, I just realized, that that block is actualy from this mod...
So, I've updated the step 1 of this mod, now it should work with additional fields correctly.
Title: Re: [MOD] Paging for comments
Post by: glitzer on February 19, 2006, 08:17:01 PM
Thank you Vano!
It works great now!
Thank you very much!
Title: Re: [MOD] Paging for comments
Post by: glitzer on February 19, 2006, 08:26:57 PM
How can i get this for the member profile also too?

In the profile i have the link to.. comments of this user.. when i click this link i see all comments of the user on one site..
Title: Re: [MOD] Paging for comments
Post by: glitzer on February 21, 2006, 09:26:58 PM
Hello please help thanks a lot :)
Title: Re: [MOD] Paging for comments
Post by: V@no on February 22, 2006, 12:41:25 AM
You must be using some other mod, so if you have a question about that mod, then please reply to the appropriate topic.
Title: Re: [MOD] Paging for comments
Post by: glitzer on February 22, 2006, 07:14:01 AM
hello vano,
this is a question to this mod?!

Because is not the paging for comments for details.php, but the paging for comments for the members.php.
Should i make a new thread for this? :(
Greetings Alexx
Title: Re: [MOD] Paging for comments
Post by: V@no on February 22, 2006, 07:49:31 AM
Because is not the paging for comments for details.php, but the paging for comments for the members.php.
Should i make a new thread for this? :(
There is not such thing as as user comments in members.php so you must be using another mod. Reply to that mod instead.
Title: Re: [MOD] Paging for comments
Post by: obmob01 on March 16, 2006, 01:50:00 AM
u.u can't make it work in 1.7.2
Title: Re: [MOD] Paging for comments
Post by: Aleksey on March 19, 2006, 09:41:00 AM
in fresh 1.7.2 this mod works fine
Title: Re: [MOD] Paging for comments
Post by: obmob01 on March 20, 2006, 03:39:54 AM
in fresh 1.7.2 this mod works fine
really? Oo

maybe i changed something, i guess i'll have to try once again, thanks ><
Title: Re: [MOD] Paging for comments
Post by: IWS_steffen on April 17, 2006, 10:33:50 AM
toller MOD

klappt alles super. Danke

Grüsse aus Hamburg

Steffen
Title: Re: [MOD] Paging for comments
Post by: desperate_housewif on December 03, 2006, 12:49:12 PM
Der Mod funktioniert super. Bei der Anzeige möchte ich den Bereich z.T. fettgeschrieben haben:

 "Gefunden: 15 Kommentar(e) auf 4 Seite(n). Angezeigt: Kommentar 1 bis 4.

Und wo kann ich den noch bestehenden englischen Part "Go to Page" ins deutsche übersetzen.

Bislang haben Änderungen mit <b> </b> bei mir noch nicht zum Erfolg geführt.
Title: Re: [MOD] Paging for comments
Post by: desperate_housewif on December 03, 2006, 06:45:02 PM
Funktioniert prima - danke.
Title: Re: [MOD] Paging for comments
Post by: ShaqMan on December 05, 2006, 02:35:34 AM
For the comments, is it possible to do a full comments type of thing. Like you know how websites give a brief description for some news and than its like "Read the full story" and it goes to another page. I want to do that for 4images, but with the comments. If the comments are too long than I want a "Read the rest of the comment here" type of thing, and when somebody clicks that link, it takes you to another page with the rest of the comment.

Here is what i am talking about:

The Comment: (http://img121.imageshack.us/img121/535/4imagesga4.gif)

and when somebody clicks that "read the whole comment" link it will take you to a seperate page with the rest of the comment.

Does anybody know how to do that? This would be a great mod and I am sure lots of people would be like "hey this is pretty cool"

Thanks for the help!
Title: Re: [MOD] Paging for comments
Post by: mawenzi on December 06, 2006, 03:25:06 PM
...
and when somebody clicks that "read the whole comment" link it will take you to a seperate page with the rest of the comment.
...

... it is possible to show a short version of comments and a link to whole version ...
... but where du you want to show the whole version ... what / where is the "seperate page" ...

Title: Re: [MOD] Paging for comments
Post by: ShaqMan on December 07, 2006, 11:52:58 PM
...
and when somebody clicks that "read the whole comment" link it will take you to a seperate page with the rest of the comment.
...

... it is possible to show a short version of comments and a link to whole version ...
... but where du you want to show the whole version ... what / where is the "seperate page" ...



on another page. Like you know how with images it shows details.php?image_id=IMAGEID

well with comments I want the same thing.
Title: Re: [MOD] Paging for comments
Post by: mawenzi on December 08, 2006, 12:07:58 AM
... you say : a seperate page ...
... my question : what / where is the "seperate page" ...
... you say : on another page ...

1. the comments are on details.php / details.html ...
2. sorry so I can't help you ...
Title: Re: [MOD] Paging for comments
Post by: city3204 on January 06, 2007, 10:11:41 PM
This is a great mod, however,  I may of misunderstood its use.

I was hoping that it would limit how many comments can be posted under a photo overall. What I see is that it will display the number of comments according to the setting on the drop down tab (5, 10, 15 or whatever number you choose) under the photo.

I was hoping that it would limit the number of overall comments. In other words, once it reached 15 comments, it would automatically delete the first comment (earliest comment) when a user placed comment 16, etc, keeping the overall comments to 15.

I know you can change the setting so the user can delete his own comments under his picture but users are not reliable in asking for help to maintain the site.

 My reason for wanting this  is to keep the site from being overwhelmed and bogged down. Actually, I would like to limit it to less than 15, but more like 7 or 8 overall comments.

Does this mod do this? If not, is there a way to adapt it so it does. I have some users who go comment crazy and I usually have to go in as the admin to delete them to keep things under control. I wish I had the php skill to adapt this mod to do this but I don't. Any help would be appreciated.

Thanks
Steve
Title: Re: [MOD] Paging for comments
Post by: city3204 on January 07, 2007, 05:17:47 PM
V@no any help or comment on my previous post

Thanks
steve
Title: Re: [MOD] Paging for comments
Post by: city3204 on January 08, 2007, 01:23:20 PM
I guess I will try getting help one more time before giving help.

Thanks

Title: Re: [MOD] Paging for comments
Post by: Neo777 on January 17, 2007, 11:11:25 PM
I tried to install this mod, but my details.php has not exactly this code.

My code is:

Code: [Select]
if ($image_allow_comments == 1) {
  $site_template->register_vars(array(
      "has_rss"   => true,
      "rss_title" => "RSS Feed: ".$image_name." (".str_replace(':', '', $lang['comments']).")",
      "rss_url"   => $script_url."/rss.php?action=comments&amp;".URL_IMAGE_ID."=".$image_id
  ));

  $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq")."
          FROM ".COMMENTS_TABLE." c
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.image_id = $image_id
          ORDER BY c.comment_date ASC";
  $result = $site_db->query($sql);

Please help me, what shall I do?

greetings

P.S.: Falls ihr mir deutsch antworten könntet wäre es 1.000x besser ;)
Title: Re: [MOD] Paging for comments
Post by: ccsakuweb on April 05, 2007, 03:02:21 PM
hi i have 1.7.3 version. this mod doesnt work . i see the form and the paging but i see all comments in all pages.. i have to install the path for 1.7.1?? and something else?

please help me.. thank you for this great mod

I attached details.php
Title: Re: [MOD] Paging for comments
Post by: ccsakuweb on April 07, 2007, 02:11:29 PM
i found my error. i forgoted to add
   
Code: [Select]
  LIMIT $offset, $commentperpage"; after
Code: [Select]
          ORDER BY c.comment_date DESC
thank you for this great mod ^^
Title: Re: [MOD] Paging for comments
Post by: Martin2006-B-2 on October 29, 2007, 12:49:26 PM
@Neo777

For Version 1.7.4 it looks like this:

Code: [Select]
if ($image_allow_comments == 1) {
  $site_template->register_vars(array(
      "has_rss"   => true,
      "rss_title" => "RSS Feed: ".$image_name." (".str_replace(':', '', $lang['comments']).")",
      "rss_url"   => $script_url."/rss.php?action=comments&amp;".URL_IMAGE_ID."=".$image_id
  ));

  $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq")."
          FROM ".COMMENTS_TABLE." c
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.image_id = $image_id
          ORDER BY c.comment_date ASC";
  $result = $site_db->query($sql);

You have to replace this part:

Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
          FROM ".COMMENTS_TABLE." c
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.image_id = $image_id
          ORDER BY c.comment_date ASC
          LIMIT $offset, $commentperpage";
  $result = $site_db->query($sql);

with this part

Code: [Select]
if (isset($HTTP_POST_VARS['commentsetperpage']) || isset($HTTP_GET_VARS['commentsetperpage'])) {
  $commentsetperpage = (intval($HTTP_POST_VARS['commentsetperpage']) ) ? intval($HTTP_POST_VARS['commentsetperpage']) : intval($HTTP_GET_VARS['commentsetperpage']);
  if ($commentsetperpage) {
    $site_sess->set_session_var("commentperpage", $commentsetperpage);
    $session_info['commentperpage'] = $commentsetperpage;
  }
}

if (isset($session_info['commentperpage'])) {
  $commentperpage = $session_info['commentperpage'];
}
else {
  $commentperpage = 5;
}
$commentsperpage_dropdown = "\n<select name=\"commentsetperpage\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['commentsperpage'].submit() }\" class=\"select\">\n";
for($i = 1; $i <= 15; $i++) {
  $setvalue = 1 * $i;
  $commentsperpage_dropdown .= "<option value=\"".$setvalue."\"";
    if ($setvalue == $commentperpage) {
    $commentsperpage_dropdown .= " selected=\"selected\"";
  }
  $commentsperpage_dropdown .= ">";
  $commentsperpage_dropdown .= $setvalue;
  $commentsperpage_dropdown .= "</option>\n";
}
$commentsperpage_dropdown .= "</select>\n";

$site_template->register_vars("commentsperpage_dropdown", $commentsperpage_dropdown);
$commentsperpage_dropdown_form = $site_template->parse_template("commentsperpage_dropdown_form");
$site_template->register_vars("commentsperpage_dropdown_form", $commentsperpage_dropdown_form);

  $sql = "SELECT COUNT(image_id) AS comments
      FROM ".COMMENTS_TABLE."
      WHERE image_id = $image_id";
$result = $site_db->query_firstrow($sql);
$site_db->free_result();
$num_comments = $result['comments'];
if ($action == "postcomment") {
$page = ceil($num_comments / $commentperpage);
}
$num_rows_all = (isset($num_comments)) ? $num_comments : 0;
$link_arg = $site_sess->url(ROOT_PATH."details.php?image_id=$image_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $commentperpage, $num_rows_all, $link_arg, $lang['comment_stats'], "comments");
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
  "paging" => $getpaging->get_paging(),
  "paging_stats" => ($num_comments) ? $getpaging->get_paging_stats() : ""
));
  $additional_sql = "";
  if (!empty($additional_user_fields)) {
    $table_fields = $site_db->get_table_fields(USERS_TABLE);
    foreach ($additional_user_fields as $key => $val) {
      if (isset($table_fields[$key])) {
        $additional_sql .= ", u.$key";
      }
    }
  }
  $sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
          FROM ".COMMENTS_TABLE." c
          LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
          WHERE c.image_id = $image_id
          ORDER BY c.comment_date DESC
          LIMIT $offset, $commentperpage";
  $result = $site_db->query($sql);


Than it should work!
Title: Re: [MOD] Paging for comments
Post by: Ankney on March 26, 2008, 03:41:52 PM
hi, the paging for comments is working but pressing the post button will always take me to the last page instead of the first. the modification which v@no describes in this thread isn't working. I'm using the newest version of 4images, 1.76. Can someone help me to solve the problem?

TIA Ankney
Title: Re: [MOD] Paging for comments
Post by: Tino23 on August 02, 2008, 10:53:33 AM
Benutzt einfach die paging.php Datei aus diesem Mod http://www.4homepages.de/forum/index.php?topic=21960.0 (http://www.4homepages.de/forum/index.php?topic=21960.0). Mach halt bloß die Änderrungen für diese Datei und laßt den Rest des Mods einfach weg. Geht wunderbar auch mit der Ver. 1.7.6 !
Title: Re: [MOD] Paging for comments
Post by: RatedRWHC on August 31, 2008, 11:13:08 AM
cool ill do this in a minute lol:D
i know this is a bit off topic lol but v@no in ur pic is that a bloke with pig tails :L
Title: Re: [MOD] Paging for comments
Post by: V@no on August 11, 2009, 03:14:02 PM
Please stop posting code from entire file.
The installation instructions is on first post of this topic.
Title: Re: [MOD] Paging for comments
Post by: V@no on August 12, 2009, 01:33:49 AM
Well, then you can start by telling what step you have problem with and what is your 4images version.
Title: Re: [MOD] Paging for comments
Post by: GaYan on August 12, 2009, 06:35:05 AM
Sir V@no . im Using 4image 1.7.6 Version :)

In Step 1 .. im not able to find the codes in details.php  :? I Found Some Code Which is closer to the code in step 1..bit thier are more codes thier than the code shown in step 1 .. !
Respecting your Comments i

Thank you ! :roll:
Title: Re: [MOD] Paging for comments
Post by: V@no on August 12, 2009, 07:05:11 AM
I've updated the step 1, and added step 1.2

P.S.
Thank you for attaching the file this time not posting as text ;)
Title: Re: [MOD] Paging for comments
Post by: GaYan on August 12, 2009, 08:08:03 AM
You Are Welcome Sir  :D It looks Neat Now..isnt it ? :) Thanks ...
Title: Re: [MOD] Paging for comments
Post by: Joss on February 08, 2010, 02:19:14 PM
I've question about sorting direction (ACS, DESC), some users wants to ASC, some DESC. Is it possible to allow users decide how sorting comments?

http://www.4homepages.de/forum/index.php?topic=5830.msg58693#msg58693

Das ist ein netter Mod! Nur wie kann man folgendes noch dazu einstellen damit immer die letzten Kommentare sichtbar sind? Also die letzte Kommentarseite des ausgewählten Bildes?

...
I think to change the order from ascending to descending is better, so u see the latest comments always on the first site.

Search
Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
         FROM ".COMMENTS_TABLE." c
         LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
         WHERE c.image_id = $image_id
         ORDER BY c.comment_date ASC
         LIMIT $offset, $commentperpage";

and replace with
Code: [Select]
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
         FROM ".COMMENTS_TABLE." c
         LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
         WHERE c.image_id = $image_id
         ORDER BY c.comment_date DESC
         LIMIT $offset, $commentperpage";

The only change is the changed order from ASC to DESC.
Title: Re: [MOD] Paging for comments
Post by: d1eter on February 17, 2010, 08:06:40 AM
hello..,
need help...

how do I change the GO button, to match the current template I'm using..
currently it looks like this (http://www.batamphotoclub.org/gallery/categories.php?cat_id=3&page=1)
I want to change it to be the same style from the template, but I don;t know how...

thank you!
Title: Re: [MOD] Paging for comments
Post by: mawenzi on February 17, 2010, 11:33:27 AM
hello d1eter ...

... yes, it doesn't look good ...
... and it is hard to find this small inaccuracy, and I saw it on many 4images websites which use V@no's paging class ...
... but ...
... this mistake comes not from [MOD] Paging for comments ... !
... it is a mistake in V@no's [MOD] Universal Paging Class v1.1 ...
... a mistake with the class="pagingbutton" instead of class="button" and class="paginginput" instead of class="input" ...
... so, in V@no's paging.php find ( in the zip-attachment of the [MOD] Universal Paging Class v1.1 ) ...


$html .= "&nbsp;".$lang['gotopage']."&nbsp;<input type=\"text\" size=\"2\" name=\"page\" value=\"\" class=\"paginginput\" />\n<input type=\"submit\" value=\"".$lang['pagebutton']."\" class=\"pagingbutton\" />\n</form>";


... an replace it with the followig ...


$html .= "&nbsp;".$lang['gotopage']."&nbsp;<input type=\"text\" size=\"2\" name=\"page\" value=\"\" class=\"input\" />\n<input type=\"submit\" value=\"".$lang['pagebutton']."\" class=\"button\" />\n</form>";


... or you can create new class "pagingbutton" and "paginginput" in your style.css to your needs (e.G. the same as "button" and "input") ...

... that's all ... ;)
... thank V@no for all your perfectly 4images mods ...  :mrgreen:
Title: Re: [MOD] Paging for comments
Post by: V@no on February 17, 2010, 03:39:01 PM
Thanks, mawenzi. One should not use "input" class in default template as it has specific width set. I probably changed it later or simply forgot mention in the mod's instructions...fixed now.
Title: Re: [MOD] Paging for comments
Post by: mawenzi on February 17, 2010, 04:22:56 PM
... ok, "input" class in default template has width larger than is needed for this small input ...
... so the best and fastest way to fix that all is to create new classes "pagingbutton" and "paginginput" in style.css ...
Title: Re: [MOD] Paging for comments
Post by: d1eter on February 18, 2010, 02:33:03 AM
Thank you mawenzi..,
and of course.. I truly appreciate V@no for all his remarkable mods making 4images a superior image gallery.
and all other php gurus in the forum willing to help users in this forum..
especially users with limited php knowledge like me...  :D need your help to point the specified files or lines

ok..,
back to topic.. so I modified the Universal Paging Class paging.php .. and create a new class for "paginginput"
the paging button can still use the "button" class from the default template.., looks the same to me.

thank you!
:mrgreen:
Title: Re: [MOD] Paging for comments
Post by: V@no on February 18, 2010, 03:00:30 AM
I don't get it...is problem solved or you still need an assistance? the "go" buttons looks fine to me..looks same as all others buttons
Title: Re: [MOD] Paging for comments
Post by: d1eter on February 18, 2010, 04:08:56 AM
problem solved v@no..
thanks!
 :D
Title: Re: [MOD] Paging for comments
Post by: zakaria666 on August 29, 2010, 04:27:06 PM
@Vano :D

 :DI have installed this MOD :D as i need this MOD to integrate another MOD, :D is there a way i can install this MOD :D but not have it affect the coments?? :D so there is no paging to comments? :D

P.S, 1 more thing :P, i am using your ajax comments rating system and u have said to me that anything i change in comments in detail.php must be changed in ajaxcomments.php  :cry:but i cannot find step 1 in ajax comments. :wink: Thank u sir :o

thanks sir 8O
Title: Re: [MOD] Paging for comments
Post by: V@no on August 29, 2010, 07:12:10 PM
:DI have installed this MOD :D as i need this MOD to integrate another MOD, :D is there a way i can install this MOD :D but not have it affect the coments?? :D so there is no paging to comments? :D
sorry, I have no idea how this supposed to work "I want do the changes but the changes should not affect what has been changed." Perhaps changing "another MOD" with the name AND link to that mod could get you another answer.

P.S, 1 more thing :P, i am using your ajax comments rating system and u have said to me that anything i change in comments in detail.php must be changed in ajaxcomments.php  :cry:but i cannot find step 1 in ajax comments. :wink: Thank u sir :o
That mod is exception. You don't need do anything in ajaxcomments.php as it's already supports "Paging for comments" mod.
Title: Re: [MOD] Paging for comments
Post by: Sunny C. on September 10, 2010, 11:58:06 PM
Hi Vano,

It would be also possible that the newest comment is displayed first?

Ps.: Add to: Mods Works Perfektly at 1.7.8 / Mods Laufen Perfekt mit 1.7.8 (http://www.4homepages.de/forum/index.php?topic=27691.0)
Title: Re: [MOD] Paging for comments
Post by: V@no on September 11, 2010, 12:46:11 AM
In step 1.2 replace ASC with DESC
Title: Re: [MOD] Paging for comments
Post by: Marion on May 08, 2011, 12:16:24 PM
Hi,
I need a little help with this mod.
I first installed Universal Paging 1.1.2 > all fine.
I installed Paging for comments with no errors. I can see on details.html :Found 8 comments ... incl. Dropdown, also below Erste Seite 1..2..3...  and   Go.
BUT there is no splitting of the comments. All 8 comments are shown on each site although I choose f.e.  3.

4images 1.7.9

details.php-text is attached

edit: I've just seen, there is an error when posting an new comment (comment appears nevertheless) :
DB Error: Bad SQL Query: SELECT comment_ip, comment_date FROM 4images_comments WHERE image_id = 1014 ORDER BY comment_date DESC LIMIT ,
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5


schonmal vielen Dank
Marion
Title: Re: [MOD] Paging for comments
Post by: Marion on May 15, 2011, 09:24:14 AM
I would be very glad if someone could help. Unfortunately I can't master it by myself, neither the thing with no splitting of the comments nor the
thing with the error message.
I want to use the MOD in combination with the simple Guestbook (http://www.4homepages.de/forum/index.php?topic=25008) .