Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: przeróbka
Forum PHP.pl > Forum > PHP
jarmiar
jak to przerobić, aby pokazywało tylko 5 najnowszych newsów?

  1. <?php
  2. /*---------------------------------------------------+
  3. | PHP-Fusion 6 Content Management System
  4. +----------------------------------------------------+
  5. | Copyright Š 2002 - 2005 Nick Jones
  6. | <a href=\"http://www.php-fusion.co.uk/\" target=\"_blank\">http://www.php-fusion.co.uk/</a>
  7. +----------------------------------------------------+
  8. | Released under the terms & conditions of v2 of the
  9. | GNU General Public License. For details refer to
  10. | the included gpl.txt file or visit <a href=\"http://gnu.org\" target=\"_blank\">http://gnu.org</a>
  11. +----------------------------------------------------+
  12.  
  13. +----------------------------------------------------+
  14. | News Ticker Script by Matonor
  15. | Infusion Code by MrX2003
  16. | v 1.02 fix by Matonor
  17. +---------------------------------------------------*/
  18.  
  19. if (file_exists(INFUSIONS."news_ticker_panel/locale/".$settings['locale'].".php")) {
  20. include INFUSIONS."news_ticker_panel/locale/".$settings['locale'].".php";
  21. } else {
  22. include INFUSIONS."news_ticker_panel/locale/English.php";
  23. }
  24. @opentable($locale['NTIC_001']);
  25.  
  26. //settings
  27. //0 = no, 1= yes
  28.  
  29. //show author?
  30. $ticker_author = "0";
  31.  
  32. //show date?
  33. $ticker_date = "0";
  34.  
  35. //show commentcount?
  36. $ticker_comments = "0";
  37.  
  38. //show readcounts?
  39. $ticker_reads = "0";
  40.  
  41. //the higher the value the slower, default is 100
  42. $ticker_speed = "100";
  43.  
  44. //ticker width? (use either % or px values)
  45. $ticker_width = "100%";
  46.  
  47.  $tickerquery = dbquery("SELECT tn.*, tu.user_id,user_name ,COUNT(comment_item_id) AS news_comments
  48. FROM ".$db_prefix."news tn
  49. LEFT JOIN ".$db_prefix."users tu ON tn.news_name=tu.user_id
  50. LEFT JOIN ".$db_prefix."comments ON news_id=comment_item_id AND comment_type='N'
  51. GROUP BY news_id
  52. ORDER BY news_datestamp DESC LIMIT 0,10");
  53.  
  54.  
  55.  while($data < 5) {
  56. $ticker_content .= "<span style='font-weight:bold;'><a href=\"".BASEDIR."news.php?readmore=".$data['news_id']."\">".$data['news_subject']."</a></span> ";
  57. if($ticker_author+$ticker_date+$ticker_comments+$ticker_reads != "0" ) {
  58.  $ticker_content .= "[";
  59.  
  60. if($ticker_author == "1") {
  61. $ticker_content .= $locale['040'].$data[user_name];
  62. if($ticker_date+$ticker_comments+$ticker_reads != "0"){
  63. $ticker_content .= " | ";
  64. }
  65. }
  66.  
  67.  
  68.  
  69. if($ticker_date == "1") {
  70. $ticker_content .= showdate("shortdate", $data['news_datestamp']);
  71. if($ticker_comments+$ticker_reads != "0"){
  72. $ticker_content .= " | ";
  73. }
  74. }
  75.  
  76.  
  77. if($ticker_comments == "1") {
  78. $ticker_content .= $data['news_comments'] .$locale['043'];
  79. if($ticker_reads != "0"){
  80. $ticker_content .= " | ";
  81. }
  82. }
  83.  
  84. if($ticker_reads == "1") {
  85. $ticker_content .= $data['news_reads'] .$locale['044'];
  86. }
  87.  
  88. $ticker_content .= "]";
  89.  }
  90. $ticker_content .= "  |  ";
  91. }
  92. echo $ticker_content;
  93.  
  94. @closetable();
  95. ?>
devnul
linia 52 zmien 10 na 5 i takie cos to do przedszkole chyba?
klocu
LIMIT (od ktorego rekordu zaczac),(ile pokazac)
LIMT (ile wybrac)

masz dwie konstrukcje. bazowanie na gotowcach nie zwalnia od zapoznania sie za manualem...
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.