Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Problem z newsami
Forum PHP.pl > Forum > Przedszkole
robertvandee
Witam, kupiłem na grafa.biz kilka themów, natomiast na każdym z nich wyskakuje informacja po dodaniu newsa:

Unknown column 'comment_hidden' in 'where clause'
Notice: Undefined index: news_image_link in /home/bitparty/public_html/news.php on line 57

Notice: Undefined index: news_image_t2 in /home/bitparty/public_html/news.php on line 59



Tutaj mam kod:

  1. <?php
  2. /*-------------------------------------------------------+
  3. | PHP-Fusion Content Management System
  4. | Copyright (C) 2002 - 2011 Nick Jones
  5. | <a href="http://www.php-fusion.co.uk/" target="_blank">http://www.php-fusion.co.uk/</a>
  6. +--------------------------------------------------------+
  7. | Filename: news.php
  8. | Author: Nick Jones (Digitanium)
  9. +--------------------------------------------------------+
  10. | This program is released as free software under the
  11. | Affero GPL license. You can redistribute it and/or
  12. | modify it under the terms of this license which you
  13. | can read by viewing the included agpl.txt or online
  14. | at www.gnu.org/licenses/agpl.html. Removal of this
  15. | copyright header is strictly prohibited without
  16. | written permission from the original author(s).
  17. +--------------------------------------------------------*/
  18. require_once "maincore.php";
  19. require_once THEMES."templates/header.php";
  20.  
  21. // Predefined variables, do not edit these values
  22. $i = 0;
  23. $n = 0;
  24.  
  25. // Number of news displayed
  26. $items_per_page = $settings['newsperpage'];
  27.  
  28. add_to_title($locale['global_200'].$locale['global_077']);
  29.  
  30. if (!isset($_GET['readmore']) || !isnum($_GET['readmore'])) {
  31. $rows = dbcount(
  32. "(news_id)",
  33. DB_NEWS,
  34. groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().")
  35. AND (news_end='0'||news_end>=".time().")
  36. AND news_draft='0'"
  37. );
  38. if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
  39. if ($rows) {
  40. $result = dbquery(
  41. "SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status
  42. FROM ".DB_NEWS." tn
  43. LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
  44. LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
  45. WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().")
  46. AND (news_end='0'||news_end>=".time().") AND news_draft='0'
  47. GROUP BY news_id
  48. ORDER BY news_sticky DESC, news_datestamp DESC LIMIT ".$_GET['rowstart'].",".$items_per_page
  49. );
  50. $numrows = dbrows($result);
  51. echo '<div class="box-main">';
  52. while ($data = dbarray($result)) {
  53. $i++;
  54. $comments = dbcount("(comment_id)", DB_COMMENTS." WHERE comment_type='N' AND comment_hidden='0' AND comment_item_id='".$data['news_id']."'");
  55. $news_cat_image = "";
  56. $news_subject = "<a name='news_".$data['news_id']."' id='news_".$data['news_id']."'></a>".stripslashes($data['news_subject']);
  57. $news_cat_image = "<a href='".($settings['news_image_link'] == 0 ? "news_cats.php?cat_id=".$data['news_cat']
  58. : FUSION_SELF."?readmore=".$data['news_id'] )."'>";
  59. if ($data['news_image_t2'] && $settings['news_image_frontpage'] == 0) {
  60. $news_cat_image .= "<img src='".IMAGES_N_T.$data['news_image_t2']."' alt='".$data['news_subject']."' class='news-category' /></a>";
  61. } elseif ($data['news_cat_image']) {
  62. $news_cat_image .= "<img src='".get_image("nc_".$data['news_cat_name'])."' alt='".$data['news_cat_name']."' class='news-category' /></a>";
  63. } else {
  64. $news_cat_image = "";
  65. }
  66. $news_news = $data['news_breaks'] == "y" ? nl2br(stripslashes($data['news_news'])) : stripslashes($data['news_news']);
  67.  
  68. $news_info = array(
  69. "news_id" => $data['news_id'],
  70. "user_id" => $data['user_id'],
  71. "user_name" => $data['user_name'],
  72. "user_status" => $data['user_status'],
  73. "news_date" => $data['news_datestamp'],
  74. "cat_id" => $data['news_cat'],
  75. "cat_name" => $data['news_cat_name'],
  76. "cat_image" => $news_cat_image,
  77. "news_subject" => $data['news_subject'],
  78. "news_ext" => $data['news_extended'] ? "y" : "n",
  79. "news_reads" => $data['news_reads'],
  80. "news_comments" => $comments,
  81. "news_allow_comments" => $data['news_allow_comments'],
  82. "news_sticky" => $data['news_sticky']
  83. );
  84.  
  85. echo "<!--news_prepost_".$i."-->\n";
  86. if ($n%3==0) {
  87. echo '<div class="c-both">';
  88. render_news($news_subject, $news_news, $news_info);
  89. echo '</div>';
  90. }
  91. else {
  92. render_news($news_subject, $news_news, $news_info);
  93. }
  94. $n++;
  95. }
  96. echo '</div>';
  97. echo "<!--sub_news_idx-->\n";
  98. if ($rows > $items_per_page) echo "<div align='center' style=';margin-top:5px;'>\n".makepagenav($_GET['rowstart'],$items_per_page,$rows,3)."\n</div>\n";
  99. } else {
  100. opentable($locale['global_077']);
  101. echo "<div style='text-align:center'><br />\n".$locale['global_078']."<br /><br />\n</div>\n";
  102. closetable();
  103. }
  104. } else {
  105. $result = dbquery(
  106. "SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status FROM ".DB_NEWS." tn
  107. LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
  108. LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
  109. WHERE ".groupaccess('news_visibility')." AND news_id='".$_GET['readmore']."' AND news_draft='0'
  110. LIMIT 1"
  111. );
  112. if (dbrows($result)) {
  113. include INCLUDES."comments_include.php";
  114. include INCLUDES."ratings_include.php";
  115. $data = dbarray($result);
  116. if (!isset($_POST['post_comment']) && !isset($_POST['post_rating'])) {
  117. $result2 = dbquery("UPDATE ".DB_NEWS." SET news_reads=news_reads+1 WHERE news_id='".$_GET['readmore']."'");
  118. $data['news_reads']++;
  119. }
  120. $news_cat_image = "";
  121. $news_subject = $data['news_subject'];
  122. if ($data['news_image_t1'] && $settings['news_image_readmore'] == "0") {
  123. $img_size = @getimagesize(IMAGES_N.$data['news_image']);
  124. $news_cat_image = "<a href=\"java script:;\" onclick=\"window.open('".IMAGES_N.$data['news_image']."','','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=".($img_size[0]+20).",height=".($img_size[1]+20)."')\"><img src='".IMAGES_N_T.$data['news_image_t1']."' alt='".$data['news_subject']."' class='news-category' /></a>";
  125. } elseif ($data['news_cat_image']) {
  126. $news_cat_image = "<a href='news_cats.php?cat_id=".$data['news_cat']."'><img src='".get_image("nc_".$data['news_cat_name'])."' alt='".$data['news_cat_name']."' class='news-category' /></a>";
  127. }
  128. $news_news = stripslashes($data['news_extended'] ? $data['news_extended'] : $data['news_news']);
  129. if ($data['news_breaks'] == "y") { $news_news = nl2br($news_news); }
  130. $news_info = array(
  131. "news_id" => $data['news_id'],
  132. "user_id" => $data['user_id'],
  133. "user_name" => $data['user_name'],
  134. "user_status" => $data['user_status'],
  135. "news_date" => $data['news_datestamp'],
  136. "cat_id" => $data['news_cat'],
  137. "cat_name" => $data['news_cat_name'],
  138. "cat_image" => $news_cat_image,
  139. "news_subject" => $data['news_subject'],
  140. "news_ext" => "n",
  141. "news_reads" => $data['news_reads'],
  142. "news_comments" => dbcount("(comment_id)", DB_COMMENTS, "comment_type='N' AND comment_item_id='".$data['news_id']."' AND comment_hidden='0'"),
  143. "news_allow_comments" => $data['news_allow_comments'],
  144. "news_sticky" => $data['news_sticky']
  145. );
  146. add_to_title($locale['global_201'].$news_subject);
  147. echo "<!--news_pre_readmore-->";
  148. render_news($news_subject, $news_news, $news_info);
  149. echo "<!--news_sub_readmore-->";
  150. if ($data['news_allow_comments']) { showcomments("N", DB_NEWS, "news_id", $_GET['readmore'], FUSION_SELF."?readmore=".$_GET['readmore']); }
  151. if ($data['news_allow_ratings']) { showratings("N", $_GET['readmore'], FUSION_SELF."?readmore=".$_GET['readmore']); }
  152. } else {
  153. redirect(FUSION_SELF);
  154. }
  155. }
  156.  
  157. require_once THEMES."templates/footer.php";
  158. ?>



Czy ktoś będzie w stanie mi pomóc w czym probleM??
Monter08
Na pewno do dobrej wersji php-fusion masz ten szablon?
robertvandee
Tak, próbowałem z inną wersją i nadal ten sam problem. Wersja podana przez twórcę jest taka sama z moją zainstalowaną. Może to jakiś błąd w skrypcie??
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.