4images Forum & Community
4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: gti-the-sexy on February 10, 2003, 11:51:47 PM
-
how could we listing images that had commented (last comment must be in the top.)
like:
last comments:
20:32 - abcd
20:30 - ghyas
19:32 - samet
19:24 - noyut
18:10 - cat
18:09 - dog
17:35 - elps
16:28 - oxxo
16:10 - bayal
with their image details links (hyperlink)
without images, only with image name and their links
for whole 4images (not category by category)
-
1.
Insert this code in "main" file u want it to be displayed. (index.php ; categories.php ; details.php ; so on) (if u want use it on any pages, then try add it in /includes/page_header.php )
$additional_sql = "";
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
ORDER BY c.comment_date DESC
LIMIT 14";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
$site_db->free_result($result);
$num_comments = sizeof($comment_row);
if (!$num_comments) {
$comments_short = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
}
else {
$comments_short = "";
for ($i = 0; $i < $num_comments; $i++) {
$image_id = $comment_row[$i]['image_id'];
$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
if (check_permission("auth_readcomment", $cat_id)){
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_info = $lang['userlevel_guest'];
$comment_user_id = $comment_row[$i]['user_id'];
$user_row_comment = get_user_info($comment_user_id);
$comment_user_profile_link = "";
$comment_user_info = $lang['userlevel_guest'];
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_profile_link = ($comment_user_profile_link) ? "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>" : $comment_user_name;
$site_template->register_vars(array(
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
"comment_cat_name" => (!check_permission("auth_viewcat", $cat_id)) ? $image_row['cat_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\">".$image_row['cat_name']."</a>",
"comment_user_name" => $comment_user_profile_link,
"comment_user_info" => $comment_user_info,
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
));
$comments_short .= $site_template->parse_template("comment_short_bit");
}
} // end while
} //end else
$site_template->register_vars("comments_short", $comments_short);
unset($comments_short);
2.
Make new template with name comment_short_bit.html.
u have chose of using those tags:{comment_image_name}
{comment_user_name}
{comment_user_info}
{comment_headline}
{comment_text}
{comment_date}
{comment_cat_name}
3. now insert in the template that belong to the file u edited (index.php -> home.html ; categories.php -> categories.html ; so on)
{comments_short}
U can change how many comments u want to display, by changing this number: LIMIT 14";
P.S. links to image details/category/user profile should be automaticaly disabled if u not authorized to view that page.
-
Hi V@no do you have an example of this?
-
there is nothing to show, because it's all deppence on your comment_short_bit.html template.
each tag will show just a word (image name, user name/level, comment headline, comment text, date) so, it's up to u how u want it to be displayed.
-
there is nothing to show, because it's all deppence on your comment_short_bit.html template.
each tag will show just a word (image name, user name/level, comment headline, comment text, date) so, it's up to u how u want it to be displayed.
Oh, Im not sure I understand exactly what this does...is this making a list of all the comments in the gallery?
-
well, almost. its all up to u :wink:
right now it will show only last 14 comments
so, u can make the template that will show only last 14 comments headers with links to the image it was commented.
so, other words, this script pull out information from database about comments, users who post them, and image that was commented - into those {...} tags. and all u need is include that "information" in templates, where u want it to be displayed.
sorry if its still not clear enough... :?
-
Makes sense now!...are you using this anywhere on your site?
-
no, I dont, but here is an example what info it can pull out the db:
http://come.no-ip.com/example.php
-
I'm sorry for being such a beginner, but i'm not sure how to install this...I followed your example but nothing shows up...i have over 30 comments. any ideas...could you explain exactly where to put the codes...thanks.
-
I'm sorry for being such a beginner, but i'm not sure how to install this...I followed your example but nothing shows up...i have over 30 comments. any ideas...could you explain exactly where to put the codes...thanks.
sry, I didnt explain it as for beginner.... :oops:
try to add this code before //-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
there is someone asked how can by clicking on user, also show his comments...
with adding few lines to this code it's possible:
http://come.no-ip.com/example.php?user_id=22
will do the modification this evening :roll:
-
yeah that was me! i asked that question!
Thanks!
-
in the code change
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
ORDER BY c.comment_date DESC
LIMIT 14";
$result = $site_db->query($sql);
$comment_row = array();
to this:
if (isset($HTTP_GET_VARS['user_id']) and $HTTP_GET_VARS['user_id'] != ""){
$add_where = "WHERE c.user_id IN (".$user_id.")";
}else{
$add_where = "";
}
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
".$add_where."
ORDER BY c.comment_date DESC
LIMIT 14";
$result = $site_db->query($sql);
$comment_row = array();
after that, u can use in url: user_id=X where X is a user ID :roll:
also, I add another (simular) MOD:
http://www.4homepages.de/forum/viewtopic.php?t=4131
-
Hi
I already have the below code in my index.php file how do I add this mod?
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
Thanks
Steve
HighRez.com
-
try to add this code before //-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
-
That above code is already in my index.php.
-
no, u add my code, above the code u showed :roll: :wink:
-
What add "another" print out section ?
Thanks
Steve
-
I tried that and it works YAY! Thank you now I have to implement it somehow into the site without it looking out of place :P
Thanks
Steve
HighRez.com
-
That above code is already in my index.php.
what about your code in index.php?
just add the code I posted... :roll:
-
is it possible to show, when logged in, the last comments made to our images?
-
is it possible to show, when logged in, the last comments made to our images?
do u mean, "last comments" for images logged in user uploaded?
-
i want the user to be warned when someone comments his images. this warning would appear when the user logs in and should disappear after he reads them.
is it possible?
-
Great Mod.
This should get moved to the Mods & Plugins (Publishing & Support) forum, and made sticky.
It might be a little easier to find :wink: .
-
is there a way to add a small 40x40 thumbnail next to the comment list? just to give our users an idea what was commented on...
i'm sure its a minor modification , right?
-
is there a way to add a small 40x40 thumbnail next to the comment list? just to give our users an idea what was commented on...
i'm sure its a minor modification , right?
yeah, good idea! :D
here u go:
1. in the code, change:$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name
to this:$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name, i.image_media_file, i.image_thumb_file
2. this: $site_template->register_vars(array(
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
to this: if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
$thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}else {
$thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
$thumb_info = @getimagesize($thumb_file);
$width = $thumb_info[0];
$height = $thumb_info[1];
$dimension = 40;
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}else {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
$site_template->register_vars(array(
"comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\"><img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"".$config['image_border']."\"></a>",
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
now u can use in template this: {comment_image_thumb}
[EDITED]
-
oh thanks... :oops: :oops:
i have many more ideas...
i can share them if you like ;)
-
hmmm....
the 2nd step
$site_template->register_vars(array(
is found in seven different places on the orginal code.
can you be a little more specific...thanks
-
ah, well, I was talking about my code only....
but here is more specific: $site_template->register_vars(array(
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
-
Ok, I got everything working correctly. I am using this to display the latest comments in the left sidebar (underneath the random picture) and I got my comment_short_bit.html looking decent.
Here is the code if anyone's interested:
<table valign="top" width="140" border="0" cellspacing="0" cellpadding="1">
<td class="head1">
<table width="138" border="0" cellspacing="0" cellpadding="1">
<tr><td width="45%" align="center" class="row3">{comment_image_thumb}</td><td width="55%" align="center" class="row3">{comment_image_name}</td></tr>
<tr><td colspan="2" align="center" class="row3">{comment_cat_name}<P></td></tr>
<tr><td colspan="2" align="center" class="row3"><strong>{comment_headline}</strong></td></tr>
<tr><td colspan="2" align="center" class="row3">{comment_text}<p></td></tr>
<tr><td colspan="2" align="center" class="row3">Posted By: {comment_user_name}</td></tr>
<tr><td colspan="2" align="center" class="row3">User Rank: {comment_user_info}</td></tr>
<tr><td colspan="2" align="center" class="row3">Date: {comment_date}</td></tr>
</table>
</td>
<br>
</table>
I set the thumbnail to 60 pixels (instead of 40) and put this into home.html underneath the random picture table:
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr><td class="head2" height="20" align="left"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />Latest Comments</td></tr>
<tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
<tr><td align="center" class="row1"><br />{comments_short}<br /><br>
<tr><td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
</table>
-
What code to add if I want make paging after the limit comment is over.
-
What code to add if I want make paging after the limit comment is over.
if add paging feature, then this could go to MODs forum as a new MOD :wink:
its not a very big deal to do, but there are so many little things needs to be done.
sry, dont have time to do so. (geee, cant belive I actualy said that! :? ) Maybe somebody else? ;)
-
Patient :idea:
-
.
-
V@no,
in your post from 14.2 on page 3, you wrote:
"after that, u can use in url: user_id=X where X is a user ID"
Could you explain that? I just do not know what you mean by this...
Thanks
Dirk
in my post on 12.03 I gave an example for it:
http://come.no-ip.com/example.php?user_id=22
as u can see, I just added user_id=22
-
I got an idea. How about making the same thing as...
When someone adds an image, it says 'NEW' for a specified period. I want this feature for new comments. Is it possible? :roll:
-
Can someone show me how to replace the NEW images section of the index.php page, and replace it with the last 4 commented images. I created my album here:
http://vanpham.com/4images/
As you notice, all the last commented images are posting on the bottom of the page...all the way to the bottom!! I want to make the last 4 commented pictures to be horizontally set across the template under the categories secion (replacing the new images section that is normally there).
You can download the following files I tried to edit here:
http://vanpham.com/files/
I renamed index.php --> index.txt
============
Any help is apprecitated. I am fairly new to php.
-
I put this code in my page_header.php and it doesn't work right. As soon as someone leaves a comment, all the category and image links only bring up that image or the category it is in. As soon as I removed it from page_header.php everything worked fine again.
I move the code to top.php and index.php and it works fine there. Must just be an issue with page_header.php.
-
Hey great mod, but i get an error:
Fatal error: Call to undefined function: get_user_table_field() in /home/zippie/HTML/index.php on line 131
I running version 1.6 and that's almost the same. I think get_user_table_field must be something else. Maby you can help me? Because i like this mod very very much.
-
Hey great mod, but i get an error:
Fatal error: Call to undefined function: get_user_table_field() in /home/zippie/HTML/index.php on line 131
I running version 1.6 and that's almost the same. I think get_user_table_field must be something else. Maby you can help me? Because i like this mod very very much.
*/me thinking why some people still on outdated software...:? *
just go throu the code and replace all get_user_table_field(", u.", "user_name") with:
, u.user_name
the " u. letter is just an example it might be any others or it might be just missing.
-
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$additional_sql = "";
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
ORDER BY c.comment_date DESC
LIMIT 14";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
euh what do you mean?
c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
change in what? in this? , u.user_name
if yes, can you give an example? plz? :oops:
-
I already gave u an example:
just go throu the code and replace all get_user_table_field(", u.", "user_name") with:
, u.user_name
the " u. letter is just an example it might be any others or it might be just missing.
in that example was user_name .
-
After I add the following MOD to page_header.php, I chick to any pic on my site. It will appear with same pics. I'm not sure what the problems, please help me.
:cry:
Jackie
my site ==> http://album.barndisco.com
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$additional_sql = "";
$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]))."'";
}
}
if (isset($HTTP_GET_VARS['user_id']) and $HTTP_GET_VARS['user_id'] != ""){
$add_where = "WHERE c.user_id IN (".$user_id.")";
}else{
$add_where = "";
}
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
".$add_where."
ORDER BY c.comment_date DESC
LIMIT 14";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
$site_db->free_result($result);
$num_comments = sizeof($comment_row);
if (!$num_comments) {
$comments_short = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
}
else {
$comments_short = "";
for ($i = 0; $i < $num_comments; $i++) {
$image_id = $comment_row[$i]['image_id'];
$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name, i.image_media_file, i.image_thumb_file
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
if (check_permission("auth_readcomment", $cat_id)){
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_info = $lang['userlevel_guest'];
$comment_user_id = $comment_row[$i]['user_id'];
$user_row_comment = get_user_info($comment_user_id);
$comment_user_profile_link = "";
$comment_user_info = $lang['userlevel_guest'];
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_profile_link = ($comment_user_profile_link) ? "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>" : $comment_user_name;
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
$thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}else {
$thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
$thumb_info = @getimagesize($thumb_file);
$width = $thumb_info[0];
$height = $thumb_info[1];
$dimension = 40;
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}else {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
$site_template->register_vars(array(
"comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\"><img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"".$config['image_border']."\"></a>",
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
"comment_cat_name" => (!check_permission("auth_viewcat", $cat_id)) ? $image_row['cat_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\">".$image_row['cat_name']."</a>",
"comment_user_name" => $comment_user_profile_link,
"comment_user_info" => $comment_user_info,
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
));
$comments_short .= $site_template->parse_template("comment_short_bit");
}
} // end while
} //end else
$site_template->register_vars("comments_short", $comments_short);
unset($comments_short);
-
After I add the following MOD to page_header.php, I chick to any pic on my site. It will appear with same pics. I'm not sure what the problems, please help me.
sorry, I have no idea what are u talking about...and what is that code? whatever it is, it is wrong... :?
-
Please try to access to my site and chick any pics for testing........Then you will get the problems.
This code was inserted to includes/page_header.php.
:cry:
-
Please try to access to my site and chick any pics for testing........Then you will get the problems.
sorry, but I have to wait about 3-4 min untill your site opens for me...its very slow...
This code was inserted to includes/page_header.php.
is there any particulary reasons u inserted into page__header.php???? 8O
-
Nothing........
is there any particulary reasons u inserted into page__header.php???? 8O
-
sorry, didnt mean to be rude ;)
but, this should be inserted into page_header.php only if u want show your last comments on all/any pages, otherwise, u should use it only in the files u want it to be showed.
-
Can i insert this in index.php and then show in a new template?
i would call it using this for ex. index.php?template=comments
and how can i make paging of this? my site has many comments and i would like to have a limit of 20 per page, for example, and have paging below it.
also i would like to know how can i insert this pagin in this mod
http://4homepages.de/forum/viewtopic.php?t=4131
thanks
-
is it possible to make that users can choose how many last commted images they want to see??
thx for help
tobi
-
no idea?
-
i added code to my index.php and finished the "comment_short_bit.html" and then i add the
{comments_short}
in a new template called comments.html
now when i go to "index.php?template=comments" nothing shows
should i insert the code in page_header?
if so, where should it be?
thanks
-
i add the code in page_header.php and it shows last commented pics, but when i click in any thumb, it goes always to same picture, and this happen in all files (index.php, categories.php, ...)
here's the page_header.php code:
//--- End Photo Of The Day ----------------------------
$additional_sql = "";
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
ORDER BY c.comment_date DESC
LIMIT 30";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
$site_db->free_result($result);
$num_comments = sizeof($comment_row);
if (!$num_comments) {
$comments_short = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
}
else {
$comments_short = "";
for ($i = 0; $i < $num_comments; $i++) {
$image_id = $comment_row[$i]['image_id'];
$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name, i.image_media_file, i.image_thumb_file
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
if (check_permission("auth_readcomment", $cat_id)){
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_info = $lang['userlevel_guest'];
$comment_user_id = $comment_row[$i]['user_id'];
$user_row_comment = get_user_info($comment_user_id);
$comment_user_profile_link = "";
$comment_user_info = $lang['userlevel_guest'];
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_profile_link = ($comment_user_profile_link) ? "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>" : $comment_user_name;
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
$thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}else {
$thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
$thumb_info = @getimagesize($thumb_file);
$width = $thumb_info[0];
$height = $thumb_info[1];
$dimension = 120;
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}else {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
$site_template->register_vars(array(
"comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\"><img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"".$config['image_border']."\"></a>",
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
"comment_cat_name" => (!check_permission("auth_viewcat", $cat_id)) ? $image_row['cat_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\">".$image_row['cat_name']."</a>",
"comment_user_name" => $comment_user_profile_link,
"comment_user_info" => $comment_user_info,
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
));
$comments_short .= $site_template->parse_template("comment_short_bit");
}
} // end while
} //end else
$site_template->register_vars("comments_short", $comments_short);
unset($comments_short);
//-----------------------------------------------------
//--- Set Paging Vars ---------------------------------
//-----------------------------------------------------
any ideia what could possible be wrong?
thanks
-
I have greatet a new link in user box called last comments .
This opens a new template which shows the last comments .....
But the paging function doesent work and i want the comments like V@no
in a table form like the thumbnail gallery ......
here is my code in the php file :
<?php
$templates_used = 'whos_online,comment_short_bit,last_comments,commentsperpage_dropdown_form';
$main_template = 'last_comments';
define('GET_CACHES', 1);
define('ROOT_PATH', './');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
if (isset($HTTP_GET_VARS['template']) || isset($HTTP_POST_VARS['template'])) {
$template = (isset($HTTP_GET_VARS['template'])) ? stripslashes(trim($HTTP_GET_VARS['template'])) : stripslashes(trim($HTTP_POST_VARS['template']));
if (!file_exists(TEMPLATE_PATH."/".$template.".".$site_template->template_extension)) {
$template = "";
}
else {
$main_template = $template;
}
}
else {
$template = "";
}
include(ROOT_PATH.'includes/page_header.php');
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].get_category_path($cat_id)."</span>";
//-----------------------------------------------------
//--- Letzte Kommentare
//-----------------------------------------------------
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 = "";
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
ORDER BY c.comment_date DESC
LIMIT $offset, $commentperpage";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
$site_db->free_result($result);
$num_comments = sizeof($comment_row);
if (!$num_comments) {
$comments_short = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
}
else {
$comments_short = "";
for ($i = 0; $i < $num_comments; $i++) {
$image_id = $comment_row[$i]['image_id'];
$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name, i.image_media_file, i.image_thumb_file
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
if (check_permission("auth_readcomment", $cat_id)){
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_info = $lang['userlevel_guest'];
$comment_user_id = $comment_row[$i]['user_id'];
$user_row_comment = get_user_info($comment_user_id);
$comment_user_profile_link = "";
$comment_user_info = $lang['userlevel_guest'];
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_profile_link = ($comment_user_profile_link) ? "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>" : $comment_user_name;
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
$thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}else {
$thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
$thumb_info = @getimagesize($thumb_file);
$width = $thumb_info[0];
$height = $thumb_info[1];
$dimension = 80;
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}else {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
$site_template->register_vars(array(
"comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\"
width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">
<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"".$config['image_border']."\"></a>",
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
"comment_cat_name" => (!check_permission("auth_viewcat", $cat_id)) ? $image_row['cat_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\">".$image_row['cat_name']."</a>",
"comment_user_name" => $comment_user_profile_link,
"comment_user_info" => $comment_user_info,
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
));
$comments_short .= $site_template->parse_template("comment_short_bit");
}
} // end while
} //end else
$site_template->register_vars("comments_short", $comments_short);
unset($comments_short);
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
-
But the paging function doesent work
please be more specific what exacly doesnt work? do u get error messages or it just doesnt show?
did u add in your template {paging} tag?
-
I hope this would explain my problem ....
http://www.4homepages.de/forum/viewtopic.php?p=25407#25407
there are my files last_comments.php and last_comments.html
i wanted to fit your code you posted in this thread to my needs.
you can also look on my page under http://www.dmack.de.vu under party-pics ....if u register and press the "letzte kommentare" in the user box u will see the last comments but u can´t chose how much comments u want to see..... and i want those comments in a table like the thumbnails in a gallery...
thx for our fast answer
Art
-
im sorry for insist
but i really need this mod :( i have more than 1000 comments made and about 90 per day ...
this would be the solution or, another way to do it would be shown last comments made to images in their owner profiles...
none of this is possible?
i've posted my problem 3 posts above. thanks in advance
-
what tag do u se to open a picture? ( {...} )
-
The only problem is the paging is not shown in my template
I open the page wiht the link "letzte kommentare" in the user box .
There the last comments are shown .....
If i change the number of comments on the details site......
this affects the number of comments on my "last_comments" site
but i could not change the number directly on my template site ,because the dropdown menu is not shown on my new template ......
do u have an idea why ? my code is posted here :
http://www.4homepages.de/forum/viewtopic.php?p=25407#25407
-
in that new template that this mod tells to creat "coment_short_bit.html"
i use
{comment_image_name}
{comment_cat_name}
and
{comment_image_thumb}
is this what u asked? :roll:
lol... were u talking to me? :oops:
-
i would ask v@no
but it´s ok ! LOL
-
is this what u asked? :roll:
lol... were u talking to me? :oops:
yes ;)
well, I've gotta try it myself, then I might find out how it works...but for now, here is my example.php file:
http://come.no-ip.com/example.phps
maybe u can figure something out ;)
@Art1977:
I'm not sure what could be wrong, can I see it in action?
-
thanks mate! :D
i've seen your code and that's the code of index.php right?
i inserted the code in page_header because i don't want to show last comments in home.html, i want to have new template just for that
i created comments.html where i'd put {comments_short}
but this example of yours its different, it uses a new php file? how can i create this example.php? just copying index.php code?
maybe it would work, dunno
it's so sad to be a newbie :(
:wink:
-
i created a new php file last_comments.php
i copied the code of index.php in this file.
an modified it thats all
then i added in the user box a new link "letzte kommentare"
this links opens the last_comments.php file , that was all
but i have some problems with the layout and with the paging
the code ...
also the code has a lot of lines which are not needed
-
@vano
under
http://mitglied.lycos.de/brkcrew/4images1.7/4images/last_comments.php
u will see what i mean
now i would the last comments displayed like the categories ........
but if i copy the part of the code from categories and change it
i always get 9 times the same comment
what u see is the backup before i changed the code ......
the ftp is down at the moment so i can´t upload the file
maybe u have an idea how i could display the comments like the thumbs on the categories site ....
-
well everything is now working perfectly, with paging and everything :)
i just would like to have bellow the thumbnail the {user_name} that owns the pic, but if i insert the same tag as in details.html it shows allways the same username, and its always the user that has the #id of the # comments per page.
how can i add user_image tag in this mod?
thanks
-
...but for now, here is my example.php file:
http://come.no-ip.com/example.phps
I'm using your file but all text is displayed bold. I tried to find where you set that but couldn't find it. Could you help me?
-
It's a great mod. Follow your instruction, I could list some comments info. on he left side under detail.php mode..
But how can I make them displaying in a horizontal order instead of a verticle one.. I prefer them to be displaed in the center under the big random photo. Would it be possible to enlighten me, please?
Thanks
-
maybe u have an idea how i could display the comments like the thumbs on the categories site ....
insert {comment_image_thumb} in your comment_short_bit.html --> template
-
Thx i already included everything.
-
is paging now working? i want this feature but i can't get it working by myself
-
So... again me :)
A little question.
I made a modification to my member_profile.html template, I had inserted this into a table:
<a href="last.php?user_id={user_id}">20 last comments</a>
Looks that everything must work, it works but not with every member.
If member have no comments a link didn`t work try: http://www.pramoga.net/member.php?action=showprofile&user_id=2359
When I click "20 paskutiniu komentaru" link redirects to: http://www.pramoga.net/member.php&user_id=2359
How to solve this?
-
Uch one more problem, I think big, and why problems are always with me? :?
Whent I add this:
$additional_sql = "";
$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]))."'";
}
}
if (isset($HTTP_GET_VARS['user_id']) and $HTTP_GET_VARS['user_id'] != ""){
$add_where = "WHERE c.user_id IN (".$user_id.")";
}else{
$add_where = "";
}
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
".$add_where."
ORDER BY c.comment_date DESC
LIMIT 14";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
$site_db->free_result($result);
$num_comments = sizeof($comment_row);
if (!$num_comments) {
$comments_short = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
}
else {
$comments_short = "";
for ($i = 0; $i < $num_comments; $i++) {
$image_id = $comment_row[$i]['image_id'];
$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name, i.image_media_file, i.image_thumb_file
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
if (check_permission("auth_readcomment", $cat_id)){
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_info = $lang['userlevel_guest'];
$comment_user_id = $comment_row[$i]['user_id'];
$user_row_comment = get_user_info($comment_user_id);
$comment_user_profile_link = "";
$comment_user_info = $lang['userlevel_guest'];
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_profile_link = ($comment_user_profile_link) ? "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>" : $comment_user_name;
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
$thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}else {
$thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
$thumb_info = @getimagesize($thumb_file);
$width = $thumb_info[0];
$height = $thumb_info[1];
$dimension = 100;
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}else {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
$site_template->register_vars(array(
"comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\"><img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"".$config['image_border']."\"></a>",
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
"comment_cat_name" => (!check_permission("auth_viewcat", $cat_id)) ? $image_row['cat_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\">".$image_row['cat_name']."</a>",
"comment_user_name" => $comment_user_profile_link,
"comment_user_info" => $comment_user_info,
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
));
$comments_short .= $site_template->parse_template("comment_short_bit");
}
} // end while
} //end else
$site_template->register_vars("comments_short", $comments_short);
unset($comments_short);
To my page_header.php
All links of images goes to last commented image. How can it be?
I had to comment this code and everything works now...
-
Is it possible to integrate the last Comments in a other page outside from 4images, like a phpbb Forum?
-
Hallo
Da mein englisch leiter grotten schlecht ist verstehe ich hier fast nix deswegen schreibe ich auf deutsch und würde mich sehr über eine deutsche antwort freuen :)
habe folgendes problem habe den comment Mod mit thumbnails eingebaut nach kleines problemen am anfang ging es danach super einfach :) ich habe jetzt nur folgendes problem sobald ich ein kommentar abgebe werde ich jedes mal zu dem Bild wo ich das kommentar abgegeben habe geleitet auch wenn ich auf andere bilder klicke werde immer zu dem einen geschikt.
währe cool wenn mir hier einer helfen könnte.
MFG
-
P.S. links to image details/category/user profile should be automaticaly disabled if u not authorized to view that page.
how can i change it to see it for all?
i have installed the mod with 4i 1.7.1 and with thumbs, but i see only the gif pic ? ca anyone help me
-
Hello people.
Excelent mod. I have it working rigth out of the box.
But I want to ask you V@no... how do you make comments appear one aside the other? (in the example that you leave on the first page). I examined the code of that page, but I don't see anything out-of-common. I did a short_comment_bit.html where each comment is a separate table (as your example), but there in no way to make it appear as your layout. In my case, it always "renders" one underneath the other, as if it put a <br />
at the end of each table.
My (test) short_comment_bit.html
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<TD valign="middle">
<table border="0" cellpadding="0" cellspacing="5" class="bgcolor" align="left">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" class="bordercolor">
<tr>
<td>
<table border="0" cellpadding="3" cellspacing="1" width="100%">
<tr>
<TD width="100" height="50" align="center" colspan="2" class="catbgcolor">
{comment_image_thumb}
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
And the part of my "last.php" where {comment short} goes:
<span class="title">{site_name} - Últimos comentarios</span><br />
<hr size="1" />
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="head1" valign="top">Últimos 15 comentarios</td>
</tr>
<tr>
<td class="row2" valign="top"> {comments_short} </td>
</tr>
</table>
</td>
</tr>
</table>
It's the same layout as the main.php, but I did leave only the comments inside the main row (where categories, new images and stats goes).
Thanks in advance.
Best regards.
WR.
-
sorry for asking... it was very obvious...
I have to use {br} tag inside short_comment_bit.html...
Thanks again for this excelent mod.
-
Is there a way to implement
"My Comments" link?
I will add that link to userloginform and userlogininfo boxes (active & inactive, depending on logged in state)
so they can click on that my comments link, and that will show them not only thier comments, but the images they commented as a link so they can check each image they made a comment about..
-
hello , i have installed this mod but now shows on homepage ; no comments for this image ( before it showd only one thumbnail for all last 4 comments so i deleted this image and now says it hasnt comment for this image )
i have code below i page_header.php
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$additional_sql = "";
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
ORDER BY c.comment_date DESC
LIMIT 4";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
$site_db->free_result($result);
$num_comments = sizeof($comment_row);
if (!$num_comments) {
$comments_short = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
}
else {
$comments_short = "";
for ($i = 0; $i < $num_comments; $i++) {
$image_id = $comment_row[$i]['image_id'];
$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name, i.image_media_file, i.image_thumb_file
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
if (check_permission("auth_readcomment", $cat_id)){
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_info = $lang['userlevel_guest'];
$comment_user_id = $comment_row[$i]['user_id'];
$user_row_comment = get_user_info($comment_user_id);
$comment_user_profile_link = "";
$comment_user_info = $lang['userlevel_guest'];
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_profile_link = ($comment_user_profile_link) ? "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>" : $comment_user_name;
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
$thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}else {
$thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
$thumb_info = @getimagesize($thumb_file);
$width = $thumb_info[0];
$height = $thumb_info[1];
$dimension = 60;
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}else {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
$site_template->register_vars(array(
"comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\"><img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"".$config['image_border']."\"></a>",
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
"comment_cat_name" => (!check_permission("auth_viewcat", $cat_id)) ? $image_row['cat_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\">".$image_row['cat_name']."</a>",
"comment_user_name" => $comment_user_profile_link,
"comment_user_info" => $comment_user_info,
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
));
$comments_short .= $site_template->parse_template("comment_short_bit");
}
} // end while
} //end else
$site_template->register_vars("comments_short", $comments_short);
unset($comments_short);
-
Hallo,
ich bekomme nach der Installation folgende Fehlermeldung:
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.image_name, c.cat_name FROM galerie_images i, galerie_categories c LEFT JOIN galerie_users u ON (u.user_id = i.user_id) WHERE i.image_id = 127 AND c.cat_id = i.cat_id
Unknown column 'i.user_id' in 'on clause'
Woran liegt das? :(
-
re-do step 1
-
Very good Mod too V@no , I think that this Mod needs shortened comment_text like last comments Mod has , but in sidebar I think it is an necessity , I had to remove the comment_text from templates because some comments are really very long , is it hard to implement it ? I was trying to take an inspiration from last comments Mod , but I will remain a newbie forever :(
This is your complete (with thumbs and user link) 1.7.6 fully working code in my index.php above the PRINT
$additional_sql = "";
$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_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
ORDER BY c.comment_date DESC
LIMIT 14";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
$site_db->free_result($result);
$num_comments = sizeof($comment_row);
if (!$num_comments) {
$comments_short = "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
}
else {
$comments_short = "";
for ($i = 0; $i < $num_comments; $i++) {
$image_id = $comment_row[$i]['image_id'];
$sql = "SELECT i.image_id, i.cat_id, i.image_name, c.cat_name, i.image_media_file, i.image_thumb_file
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
if (check_permission("auth_readcomment", $cat_id)){
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_info = $lang['userlevel_guest'];
$comment_user_id = $comment_row[$i]['user_id'];
$user_row_comment = get_user_info($comment_user_id);
$comment_user_profile_link = "";
$comment_user_info = $lang['userlevel_guest'];
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_profile_link = ($comment_user_profile_link) ? "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>" : $comment_user_name;
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
$thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}else {
$thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
$thumb_info = @getimagesize($thumb_file);
$width = $thumb_info[0];
$height = $thumb_info[1];
$dimension = 60;
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}else {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
$site_template->register_vars(array(
"comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"0".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\"><img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"0".$config['image_border']."\"></a>",
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
"comment_cat_name" => (!check_permission("auth_viewcat", $cat_id)) ? $image_row['cat_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\">".$image_row['cat_name']."</a>",
"comment_user_name" => $comment_user_profile_link,
"comment_user_info" => $comment_user_info,
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
));
$comments_short .= $site_template->parse_template("comment_short_bit");
}
} // end while
} //end else
$site_template->register_vars("comments_short", $comments_short);
unset($comments_short);
This is the 2 parts of code from last comments ( was trying to play around with it to implement that to the code above (changed $text for $comment_text but nothing happened-:):
$text_len = 200; //max lenght of the text to show (bbcode and html are counted too)
$text = $row['comment_text'];
if (strlen($text) > $text_len)
{
$text = substr($text, 0, $text_len)." ...";
}