Witam, mam problem z skryptem ostatnie komentarze (lastcomments) który generuje mi na inny adres url artykułu niż oryginalny.


Oto fragment lastcommets.php:

  1. <?
  2. function link_news()
  3. {
  4. global $conf_url;
  5. if ($conf_url == "yes")
  6. {
  7. $link_news = "http://". $_SERVER['HTTP_HOST'] ."/";
  8. }
  9. else
  10. {
  11. $url = $news_id;
  12. $link_news = "http://". $_SERVER['HTTP_HOST'] ."/index.php?newsid=";
  13. }
  14. return $link_news;
  15. }
  16.  
  17.  
  18. $query_comm_temp = "SELECT * FROM " . PREFIX . "_comments ORDER BY date DESC LIMIT " . $comm_num.";";
  19. $query_comm = $db->query($query_comm_temp);
  20.  
  21.  
  22. while ($comment = $db->get_row($query_comm))
  23. {
  24. $comment_tpl = "<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td style='padding-top: 4px;'>Autor: ";
  25. $comment_tpl .= "<a href=". link_user($comment['autor']).">". $comment['autor']."</a> W artykule:</td></tr><tr><td style='border-bottom: 1px solid #d1d7dc; padding-bottom: 4px;'>";
  26.  
  27. $query_news_temp = "SELECT * FROM ". PREFIX ."_post WHERE id=". $comment['post_id'] .";";
  28. $query_news = $db->query($query_news_temp);
  29.  
  30. while ($novost = $db->get_row($query_news))
  31. {
  32. $novost['date'] = strtotime($novost['date']);
  33.  
  34. if (strlen($novost['title']) > 35)
  35. $news = substr ($novost['title'], 0, 35)." ...";
  36. else
  37. $news = $novost['title'];
  38.  
  39. if ($conf_url == "yes") {
  40. $ssilka = date("Y/m/d/", $novost['date']).$novost['alt_name'].".html";
  41. }
  42. else {
  43. $ssilka = $novost['id'];
  44. }
  45. $comment_text = htmlspecialchars($comment['text']);
  46. if ($hint == "yes") $hint_show = "onMouseover=\"showhint('<b>Treść:</b><br>".$comment_text."', this, event, '200px')\"";
  47. $comment_tpl .= lastcomm_getscript()."<a href=\"".link_news().$ssilka."\"". $hint_show .">".$news. "</a></td></tr></table>";
  48. }
  49. $ready_tpl .= $comment_tpl;
  50. }
  51. $lastcomment = $ready_tpl;
  52. ?>



Tutaj fragment kodu który działa tak jak chcę z modułu topnews (link jest taki sam jak w oryginale)

  1. $db->query( "SELECT id, title, date, alt_name, category, flag FROM " . PREFIX . "_post WHERE approve='1' AND date >= '$this_month' - INTERVAL 1 MONTH AND date < '$this_month' ORDER BY rating DESC, comm_num DESC, news_read DESC, date DESC LIMIT 0,10" );
  2.  
  3. while ( $row = $db->get_row() ) {
  4.  
  5. $row['date'] = strtotime( $row['date'] );
  6. $row['category'] = intval( $row['category'] );
  7.  
  8. if( $config['allow_alt_url'] == "yes" ) {
  9.  
  10. if( $row['flag'] and $config['seo_type'] ) {
  11.  
  12. if( $row['category'] and $config['seo_type'] == 2 ) {
  13.  
  14. $full_link = $config['http_home_url'] . get_url( $row['category'] ) . "/" . $row['id'] . "-" . $row['alt_name'] . ".html";
  15.  
  16. } else {
  17.  
  18. $full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html";
  19.  
  20. }
  21.  
  22. } else {
  23.  
  24. $full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
  25. }
  26.  
  27. } else {
  28.  
  29. $full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
  30.  
  31. }
  32.  
  33. if( strlen( $row['title'] ) > 55 ) $title = substr( $row['title'], 0, 55 ) . " ...";
  34. else $title = $row['title'];
  35.  
  36. $go_page = ($config['ajax']) ? "onclick=\"DlePage('newsid=" . $row['id'] . "'); return false;\" " : "";
  37. if( $config['allow_comments_wysiwyg'] == "yes" ) $go_page = '';
  38.  
  39. $link = "<a {$go_page}href=\"" . $full_link . "\">" . stripslashes( $title ) . "</a>";
  40.  
  41. $topnews .= "&raquo; " . $link . "<br />";
  42. }


Próbowalem zmianiać i wstawiać kod w lastcomments z top news ale nawet kiedy wkleję caly top news do lastcomments i zmienię wygląd linka na taki jak ma być to nie wie co to (( $row['category'] ) . "/" . $row['id'] . "-" . $row['alt_name'])

Z góry dzięki za pomoc blinksmiley.gif