Fotografika | Foto forum

Witamy, Gość. Zaloguj się lub zarejestruj.
Czy dotarł do Ciebie email aktywacyjny?
Grudzień 01, 2008, 21:49:18


Zaloguj się podając nazwę użytkownika, hasło i długość sesji


więcej informacji tutaj
Uśmiech Pierwszy szablon udostępniony publicznie. Uśmiech
Szablon fotoan black v1.0 jest kompatybilny z galerią 4images wersji 1.7.3.
Szablon zawiera również polską wersję językową v.2.0
  więcej tutaj...
827 wiadomości w 192 wątkach, wysłane przez 177 użytkowników
Najnowszy użytkownik: luktur1
+  Fotografika | Foto forum
|-+  Galeria 4images
| |-+  4images ... [MOD] modyfikacje (Moderator: andreoid)
| | |-+  MOD - Ostatnie komentarze
0 użytkowników i 1 Gość przegląda ten wątek. « poprzedni następny »
Strony: [1] Do dołu Drukuj
Autor Wątek: MOD - Ostatnie komentarze  (Przeczytany 3221 razy)
andreoid
Administrator
Student

*****

Pomógł: +4/-0
Offline Offline

Płeć: Mężczyzna
Wiadomości: 308



OS:
unknown
Browser:
unknown


Skype - Kliknij do mnie

Zobacz profil WWW
« : Październik 03, 2006, 01:24:08 »

MOD ostatnie komentarze
wyświetla nam, pięć ostatnio wpisanych komentarzy na stronie startowej galerii.

Demo
 
Orginalna nazwa:
[MOD] Last comments 
Autor: V@no
Wersja: 1.0

Instalacja: ... Łatwa
Czas: ........... około 15 minut

Zmienione zostaną pliki:

index.php
/lang/polish/main.php
/templates/twoj_szablon/home.html

Nowe pliki:

templates/twoj_szablon/last_comment_bit.html

Otwórz plik index.php
odszukaj

Kod:
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------

Przed tym kodem dodaj

Kod:
/*
  MOD LAST COMMENTS
  START INSERT
*/
//Settings
$num = 5; //how many comments to show
$thumb_size = 55; //max dim of thumbnails in pixels
$text_len = 200; //max lenght of the text to show (bbcode and html are counted too)
//End settings

$last_comments = "";
$sql = "SELECT c.image_id, c.comment_id, c.user_id as comment_user_id, c.user_name as guest_user_name, c.comment_headline, c.comment_text, c.comment_date, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file".get_user_table_field(", u.", "user_name")." as user_name".get_user_table_field(", s.", "user_name")." as comment_user_name
        FROM ".COMMENTS_TABLE." c
        LEFT JOIN ".IMAGES_TABLE." i ON i.image_id = c.image_id
        LEFT JOIN ".USERS_TABLE." u ON ".get_user_table_field("u.", "user_id")." = i.user_id
        LEFT JOIN ".USERS_TABLE." s ON ".get_user_table_field("s.", "user_id")." = c.user_id
        WHERE i.image_active = 1 AND i.image_allow_comments = 1 AND i.cat_id NOT IN (".get_auth_cat_sql('auth_readcomment', 'NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewcat', 'NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewimage', 'NOTIN').")
        ORDER BY c.comment_date DESC
        LIMIT ".$num;
$result = $site_db->query($sql);
$bgcounter = 1;
while ($row = $site_db->fetch_array($result))
{
  $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
  if (empty($row['image_thumb_file']))
  {
    $thumb_file = ICON_PATH."/".get_file_extension($row['image_media_file']).".gif";
  }
  else
  {
    $thumb_file = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$row['cat_id']."/".$row['image_thumb_file'];
  }
  $thumb_info = @getimagesize($thumb_file);
  $width = ($thumb_info[0]) ? $thumb_info[0] : $thumb_size;
  $height = ($thumb_info[1]) ? $thumb_info[1] : $thumb_size;
  if ($width > $thumb_size && $height > $thumb_size)
  {
    $ratio = $width / $height;
    if ($ratio > 1) {
      $new_width = $thumb_size;
      $new_height = round(($thumb_size/$width) * $height);
    }else {
      $new_width = round(($thumb_size/$height) * $width);
      $new_height = $thumb_size;
    }
  }
  else
  {
    $new_width = $width;
    $new_height = $height;
  }
  $view_image = true;
  $thumb = "<img src=\"".$thumb_file."\" border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
/*
  $view_image = check_permission('auth_viewcat', $row['cat_id']);
  $thumb = "<img src=\"".$thumb_file."\"".(($view_image) ? "" : " onClick=\"alert('".(($lang['auth_alert'][$cat_id]) ? $lang['auth_alert'][$cat_id] : $lang['auth_alert']['default'])."');\"")." border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
*/
  $image_user_name = ($row['user_id'] != GUEST) ? $row['user_name'] : $lang['userlevel_guest'];
  $image_user_link = ($row['user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['user_id']) : "";
  $comment_user_name = ($row['comment_user_id'] == GUEST) ? ((empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : $row['guest_user_name']) : $row['comment_user_name'];
  $comment_user_link = ($row['comment_user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['comment_user_id']) : "";
  $text = $row['comment_text'];
  if (strlen($text) > $text_len) {
    $text = substr($text, 0, $text_len)." ...";
  }
  $site_template->register_vars(array(
    "last_comments_more" => "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showcomments", "&")."\">".$lang['last_comments_more']."</a>",
    "comment_image" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$row['image_id'])."\">".$thumb."</a>" : $thumb,
    "comment_guest" => ($row['comment_user_id'] == GUEST && !empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : "",
    "comment_image_name" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\">".stripslashes($row['image_name'])."</a>" : stripslashes($row['image_name']),
    "image_cat_name" => (check_permission('auth_viewcat', $row['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$row['cat_id'])."\">".$cat_cache[$row['cat_id']]['cat_name']."</a>" : $cat_cache[$row['cat_id']]['cat_name'],
    "image_user_name" =>   ($image_user_link) ? "<a href=\"".$image_user_link."\">".$image_user_name."</a>" : $image_user_name,
    "comment_user_name" => ($comment_user_link) ? "<a href=\"".$comment_user_link."\">".$comment_user_name."</a>" : $comment_user_name,
    "comment_user_id" => $row['comment_user_id'],
    "comment_headline" => format_text($row['comment_headline'], 0, $config['wordwrap_comments'], $config['bb_comments'], 0, 1),
    "comment_text" => format_text($text, $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments'], 1, 0),
    "comment_date" => format_date($config['date_format']." ".$config['time_format'], $row['comment_date']),
    "row_bg_number" => $row_bg_number
  ));
  $last_comments .= $site_template->parse_template("last_comment_bit");
}
/*
if (empty($last_comments))
{
  $last_comments = $lang['no_comments'];
}
*/
$site_template->register_vars(array(
  "lang_last_comments" => $lang['last_comments'],
  "last_comments" => $last_comments
));
/*
  MOD LAST COMMENTS
  START INSERT
*/

Otwórz plik main.php
ścieżka /lang/polish/main.php
odszukaj (na samym końcu)

Kod:
?>

Przed tym kodem dodaj

Kod:
$lang['last_comments'] = "5 Ostatnich komentarzy";
$lang['last_comments_more'] = "Więcej komentarzy";

Otwórz plik home.html
ścieżka /templates/twoj_szablon/home.html
i w dogodnym dla Ciebie miejscu wpisz ten kod

Kod:
<br />
{if last_comments}

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><strong>{lang_last_comments}</strong></td>
    <td><div align="right"><a href="{url_comments_all}"><strong>{lang_all_comments} ...</strong></a>&nbsp;</div></td>
  </tr>
</table><br />

<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td class="head1">{last_comments}</td>
  </tr>
</table>
{endif last_comments}
                <br />

Stwórz nowy plik last_comment_bit.html
ścieżka templates/twoj_szablon/last_comment_bit.html

Kod:
<tr>
    <td valign="top" width="10%" class="head1" rowspan="1"><strong>Foto:</strong></td>
    <td valign="top" width="20%" class="head1" rowspan="1"><strong>Tytu?:</strong></td>
    <td valign="top" width="15%" class="head1" rowspan="1"><strong>Kategoria:</strong></td>
    <td valign="top" width="15%" class="head1" rowspan="1"><strong>Kto i kiedy:</strong></td>
    <td valign="top" width="40%" class="head1" rowspan="1"><strong>Komentarz:</strong></td>
</tr>
  <tr>
    <td colspan="1">
  <TR class="row1">
    <TD width="10%" height="60" align="center" rowspan="2"> {comment_image} </TD>
    <TD width="10%" rowspan="2">{comment_image_name}</TD>
    <TD width="10%" rowspan="2" >[{image_cat_name}]</TD>
    <td width="20%"rowspan="2" nowrap> przez: <br>
{comment_user_name}{if comment_guest} ({comment_guest}){endif
      comment_guest}<br />
  <br>
      dnia: <br>
{comment_date} </td>
    <TD><strong>{comment_headline}</strong></TD>
  </tr>
  <tr class="row1">
    <TD>{comment_text}</TD>
  </TR>

Plik last_comment_bit.html jest tylko przykładem i można go dopasować w inny sposób do własnej strony, wykorzystując dodając zmienne poniżej.

Objaśnienie użytych zmiennych:

dla kodu dodanego do /templates/twoj_szablon/home.html

{lang_last_comments} - tytuł "5 Ostatnich komentarzy"
{last_comments} - lista ostatnich komentarzy
{last_comments_more} - link "Więcej komentarzy" (odnośnik do MOD'u Wszystkie komentarze)

dla kodu /templates/twoj)szablon/last_comment_bit.html

{comment_image} - miniatura komentowanego zdjęcia
{comment_guest} - tekst "Gość" w przypadku kiedy autorem komentarza jest gość
{comment_image_name} - tytuł (nazwa)  komentowanego zdjęia
{image_cat_name} - kategoria komentowanego zdjęcia
{image_user_name} - autor komentowanego zdjęcia
{comment_user_name} - zarejestrowany autor komentarza
{comment_user_id} - ID: zarejestrowany autor komentarza
{comment_headline} - tytuł komentarza
{comment_text} - tekst komentarza
{comment_date} - data i czas kiedy wpisano komentarz
« Ostatnia zmiana: Luty 17, 2007, 22:55:47 wysłane przez andreoid » Zapisane

:: Canon EOS 20 D..Canon EOS 350 D..Obiektywy:Canon EF 70-200mm f4.0 L USM..EF 28-135mm f3.5/5.6 IS USM..EF S 18-55 Kit..(poluje na Sigma 150mm f2.8 EX DG A
zoom
Użytkownik

*

Pomógł: +0/-0
Offline Offline

Wiadomości: 11

OS:
Windows XP
Browser:
Microsoft Internet Explorer 6.0



Zobacz profil
« Odpowiedz #1 : Kwiecień 06, 2007, 14:53:37 »

mysle ze niczego nei przeoczylem - nie wybiera mi kategorii: http://www.zoom.goin.pl/stat.php
Zapisane
stomka.net
Uczeń

**

Pomógł: +1/-0
Offline Offline

Płeć: Mężczyzna
Wiadomości: 70



OS:
Windows XP
Browser:
Firefox 1.5.0.11


Skype - Kliknij do mnie

Zobacz profil WWW
« Odpowiedz #2 : Kwiecień 06, 2007, 19:53:39 »

Wrzuć do wątku plik index.php i
templates/twoj_szablon/last_comment_bit.html

może cos tam jednak jest nie tak

Zapisane

Zapraszam do otwartej galerii fotograficznej www.stomka.net
zoom
Użytkownik

*

Pomógł: +0/-0
Offline Offline

Wiadomości: 11

OS:
Windows XP
Browser:
Microsoft Internet Explorer 6.0



Zobacz profil
« Odpowiedz #3 : Kwiecień 07, 2007, 07:40:42 »

Mod umiescilem w stworzonym pliku stat.php. Stworzylem go na bazie index.php. to ja cos przeoczylem modyfikujac go...

stat.php
Kod:
<?php

$templates_used 
'home,category_bit,whos_online,thumbnail_bit';
$main_template 'stat';

//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');

if (!empty(
$template)) {
  
$clickstream "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].str_replace("_"" "ucfirst($template));
  
$site_template->register_vars("clickstream"$clickstream);
  
$site_template->print_template($site_template->parse_template($main_template));
  include(
ROOT_PATH.'includes/page_footer.php');
}

//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------


//-----------------------------------------------------
//--- Show New Images ---------------------------------
//-----------------------------------------------------


/*
  MOD LAST COMMENTS
  START INSERT
*/
//Settings
$num 5//how many comments to show
$thumb_size 55//max dim of thumbnails in pixels
$text_len 200//max lenght of the text to show (bbcode and html are counted too)
//End settings

$last_comments "";
$sql "SELECT c.image_id, c.comment_id, c.user_id as comment_user_id, c.user_name as guest_user_name, c.comment_headline, c.comment_text, c.comment_date, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file".get_user_table_field(", u.""user_name")." as user_name".get_user_table_field(", s.""user_name")." as comment_user_name
        FROM "
.COMMENTS_TABLE." c
        LEFT JOIN "
.IMAGES_TABLE." i ON i.image_id = c.image_id
        LEFT JOIN "
.USERS_TABLE." u ON ".get_user_table_field("u.""user_id")." = i.user_id
        LEFT JOIN "
.USERS_TABLE." s ON ".get_user_table_field("s.""user_id")." = c.user_id
        WHERE i.image_active = 1 AND i.image_allow_comments = 1 AND i.cat_id NOT IN ("
.get_auth_cat_sql('auth_readcomment''NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewcat''NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewimage''NOTIN').")
        ORDER BY c.comment_date DESC
        LIMIT "
.$num;
$result $site_db->query($sql);
$bgcounter 1;
while (
$row $site_db->fetch_array($result))
{
  
$row_bg_number = ($bgcounter++ % == 0) ? 2;
  if (empty(
$row['image_thumb_file']))
  {
    
$thumb_file ICON_PATH."/".get_file_extension($row['image_media_file']).".gif";
  }
  else
  {
    
$thumb_file = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$row['cat_id']."/".$row['image_thumb_file'];
  }
  
$thumb_info = @getimagesize($thumb_file);
  
$width = ($thumb_info[0]) ? $thumb_info[0] : $thumb_size;
  
$height = ($thumb_info[1]) ? $thumb_info[1] : $thumb_size;
  if (
$width $thumb_size && $height $thumb_size)
  {
    
$ratio $width $height;
    if (
$ratio 1) {
      
$new_width $thumb_size;
      
$new_height round(($thumb_size/$width) * $height);
    }else {
      
$new_width round(($thumb_size/$height) * $width);
      
$new_height $thumb_size;
    }
  }
  else
  {
    
$new_width $width;
    
$new_height $height;
  }
  
$view_image true;
  
$thumb "<img src=\"".$thumb_file."\" border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
/*
  $view_image = check_permission('auth_viewcat', $row['cat_id']);
  $thumb = "<img src=\"".$thumb_file."\"".(($view_image) ? "" : " onClick=\"alert('".(($lang['auth_alert'][$cat_id]) ? $lang['auth_alert'][$cat_id] : $lang['auth_alert']['default'])."');\"")." border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
*/
  
$image_user_name = ($row['user_id'] != GUEST) ? $row['user_name'] : $lang['userlevel_guest'];
  
$image_user_link = ($row['user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['user_id']) : "";
  
$comment_user_name = ($row['comment_user_id'] == GUEST) ? ((empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : $row['guest_user_name']) : $row['comment_user_name'];
  
$comment_user_link = ($row['comment_user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['comment_user_id']) : "";
  
$text $row['comment_text'];
  if (
strlen($text) > $text_len) {
    
$text substr($text0$text_len)." ...";
  }
  
$site_template->register_vars(array(
    
"last_comments_more" => "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showcomments""&")."\">".$lang['last_comments_more']."</a>",
    
"comment_image" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$row['image_id'])."\">".$thumb."</a>" $thumb,
    
"comment_guest" => ($row['comment_user_id'] == GUEST && !empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : "",
    
"comment_image_name" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\">".stripslashes($row['image_name'])."</a>" stripslashes($row['image_name']),
    
"image_cat_name" => (check_permission('auth_viewcat'$row['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$row['cat_id'])."\">".$cat_cache[$row['cat_id']]['cat_name']."</a>" $cat_cache[$row['cat_id']]['cat_name'],
    
"image_user_name" =>   ($image_user_link) ? "<a href=\"".$image_user_link."\">".$image_user_name."</a>" $image_user_name,
    
"comment_user_name" => ($comment_user_link) ? "<a href=\"".$comment_user_link."\">".$comment_user_name."</a>" $comment_user_name,
    
"comment_user_id" => $row['comment_user_id'],
    
"comment_headline" => format_text($row['comment_headline'], 0$config['wordwrap_comments'], $config['bb_comments'], 01),
    
"comment_text" => format_text($text$config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments'], 10),
    
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $row['comment_date']),
    
"row_bg_number" => $row_bg_number
  
));
  
$last_comments .= $site_template->parse_template("last_comment_bit");
}
/*
if (empty($last_comments))
{
  $last_comments = $lang['no_comments'];
}
*/
$site_template->register_vars(array(
  
"lang_last_comments" => $lang['last_comments'],
  
"last_comments" => $last_comments
));
/*
  MOD LAST COMMENTS
  START INSERT
*/



//-----------------------------------------------------
//--- 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');
?>

teplates/moj_szablon/last_comment_bit.html:
Kod:
<tr>
    <td valign="top" width="10%" class="head1" rowspan="1"><strong>Foto:</strong></td>
    <td valign="top" width="20%" class="head1" rowspan="1"><strong>Tytuł:</strong></td>
    <td valign="top" width="15%" class="head1" rowspan="1"><strong>Kategoria:</strong></td>
    <td valign="top" width="15%" class="head1" rowspan="1"><strong>Kto i kiedy:</strong></td>
    <td valign="top" width="40%" class="head1" rowspan="1"><strong>Komentarz:</strong></td>
</tr>
  <tr>
    <td colspan="1" class="row2">
  <TR class="row1">
    <TD width="10%" height="60" align="center" rowspan="2"class="row2"> {comment_image} </TD>
    <TD width="10%" rowspan="2"class="row2">{comment_image_name}</TD>
    <TD width="10%" rowspan="2" class="row2">[{image_cat_name}]</TD>
    <td width="20%"rowspan="2" nowrap class="row2"> przez: <br>
{comment_user_name}{if comment_guest} ({comment_guest}){endif
      comment_guest}<br />
  <br>
      dnia: <br>
{comment_date} </td>
    <TD class="row2"><strong>{comment_headline}</strong></TD>
  </tr>
  <tr class="row1">
    <TD class="row2">{comment_text}</TD>
  </TR>

Zapisane
Strony: [1] Do góry Drukuj 
« poprzedni następny »
Skocz do:  



Dziękuję
Dziękuję za odwiedzenie naszego serwisu, mam nadzieję że jesteś zadowolona/y z pomocy którą tutaj otrzymałaś/eś.
Było by nam miło, jeżeli w zamian za uzyskaną pomoc, wkleisz na swojej stronie link do naszego serwisu.

Serwis fotograficzny

lub
Foto forum


Życzymy Ci dalszych sukcesów w dziedzinie prezentacji internetowej,
oraz wielu odwiedzin internautów.
statystyki www stat.pl
Strona wygenerowana w 0.311 sekund z 21 zapytaniami.
Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Design by fotoan.com

Tworzenie stron - Wypożyczalnia komputerów - XMLguru.net - Wczasy nad morzem - Prezenty - Gry Online
Foto serwis © 2005-2007 fotoan.com