4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started 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:if ($image_allow_comments == 1) {
Insert below: 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: "comment_id" => $comment_row[$i]['comment_id'],
Add after: "lang_comments_per_page" => $lang['comments_per_page'],
Step 1.2 added 2009-08-12
Find: ORDER BY c.comment_date ASC
Replace it with: ORDER BY c.comment_date ASC
LIMIT $offset, $commentperpage";
Step 2.
Open /lang/<yourlanguage>/main.php
Add just before closing ?>
$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:{if allow_comments}
Add after: <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:<table border="0" cellspacing="0" cellpadding="0">
<form method="post" action="{self}#comments" name="commentsperpage">
<tr>
<td>{lang_comments_per_page} </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 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
-
Excellent MOD :wink:
-
Veno the best :D :D
-
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....
-
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
-
There is better thing:
for($i = 1; $i <= 20; $i++) {
$setvalue = 5 * $i;
for the paging 5,10,15,20......,95,100
-
And there is small bug:
when no comments, paging numbers i see, but "Comments per page:" for this - not shown
-
There is better thing:
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?
-
if you dont want to see number 1,2,3,4,5,6,7........1000
modify to this:
for($i = 1; $i <= 20; $i++) {
$setvalue = 5 * $i;
after this you see:
5,10,15,20,25......100
-
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
-
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?
-
ex: with "Opera" this feature not working automaticaly when chosing "comments per page"...
commentsperpage_dropdown_form.html must be with button:
<table border="0" cellspacing="0" cellpadding="0">
<form method="post" action="{self}#comments" name="commentsperpage">
<tr>
<td>{lang_comments_per_page} </td>
<td>{commentsperpage_dropdown}</td>
<td valign="top">
<input type="submit" value="{lang_go}" class="button" />
</td>
</tr>
</form>
</table>
-
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
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
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" ???
-
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.
-
try this: http://www.4homepages.de/forum/index.php?topic=7493.0
-
Thank you very much, Vano!
I think, may be to move this link to the start of this topic?
-
how do then open photo,
automatic open last page comments?
-
up...
-
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 ;)
-
Ok, I'll answer it for you ;)
In details.php replace if ($action == "postcomment") {
with this: 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 ;)
-
YES! YES! YES! This work! Thank you very much Vano! You super coder :mrgreen:
В общем спасибо большое :) Это самое правильное дополнение к этому хаку, иначе людям приходится постоянно жать последнюю страницу чтобы посмотреть нет ли новых сообщений :)
-
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
$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
$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.
-
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 ;)
-
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:
-
ahaha, I'm an idiot :oops:
good save ;) thanks
-
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..)
-
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.
-
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?
-
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 :)
-
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. ;)
-
shit but the users and comments will be lost, won't they?
-
users, images, categories, comments, etc stays in the database, you are replacing the code, not the data.
-
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 )
$additional_user_fields['user_comments_perpage'] = array($lang['user_comments_perpage'], "text", 0);
in meber.php
sereach for
"lang_icq" => $lang['icq'],
insert under
"lang_comments_per_page_settings" => $lang['comments_per_page_settings'],
in you lang file main.php
sereach for
$lang['icq'] = "ICQ:";
insert under
$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.
<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
<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
$commentperpage = 5;
replace with
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
-
I have a problem here,
in my detail.php is the code:
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.
-
Perpahs it would be best if you show the code you "think its right" as well ;)
-
:D
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.
-
remove
$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]))."'";
}
}
}
-
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.. :)
removed
-
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.
-
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
-
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.
-
Thank you Vano!
It works great now!
Thank you very much!
-
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..
-
Hello please help thanks a lot :)
-
You must be using some other mod, so if you have a question about that mod, then please reply to the appropriate topic.
-
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
-
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.
-
u.u can't make it work in 1.7.2
-
in fresh 1.7.2 this mod works fine
-
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 ><
-
toller MOD
klappt alles super. Danke
Grüsse aus Hamburg
Steffen
-
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.
-
Funktioniert prima - danke.
-
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!
-
...
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" ...
-
...
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.
-
... 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 ...
-
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
-
V@no any help or comment on my previous post
Thanks
steve
-
I guess I will try getting help one more time before giving help.
Thanks
-
I tried to install this mod, but my details.php has not exactly this code.
My code is:
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&".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 ;)
-
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
-
i found my error. i forgoted to add
LIMIT $offset, $commentperpage";
after
ORDER BY c.comment_date DESC
thank you for this great mod ^^
-
@Neo777
For Version 1.7.4 it looks like this:
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&".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:
$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
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!
-
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
-
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 !
-
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
-
Please stop posting code from entire file.
The installation instructions is on first post of this topic.
-
Well, then you can start by telling what step you have problem with and what is your 4images version.
-
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:
-
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 ;)
-
You Are Welcome Sir :D It looks Neat Now..isnt it ? :) Thanks ...
-
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
$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
$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.
-
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!
-
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 .= " ".$lang['gotopage']." <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 .= " ".$lang['gotopage']." <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:
-
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.
-
... 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 ...
-
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:
-
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
-
problem solved v@no..
thanks!
:D
-
@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
-
: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.
-
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)
-
In step 1.2 replace ASC with DESC
-
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
-
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) .