Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> przeróbka
jarmiar
post
Post #1





Grupa: Zarejestrowani
Postów: 616
Pomógł: 12
Dołączył: 16.07.2006
Skąd: : getCity ( );

Ostrzeżenie: (0%)
-----


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. ?>


--------------------
Jeśli my czegoś nie zrobimy, zrobią to za nas inni
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
devnul
post
Post #2





Grupa: Zarejestrowani
Postów: 1 470
Pomógł: 75
Dołączył: 21.09.2005
Skąd: że znowu

Ostrzeżenie: (0%)
-----


linia 52 zmien 10 na 5 i takie cos to do przedszkole chyba?


--------------------
Profesjonaliści są przewidywalni...
strzeż się amatorów...
FL4SHB4CK - imprezy, galerie, lokale
Go to the top of the page
+Quote Post
klocu
post
Post #3





Grupa: Zarejestrowani
Postów: 291
Pomógł: 45
Dołączył: 21.08.2007

Ostrzeżenie: (0%)
-----


LIMIT (od ktorego rekordu zaczac),(ile pokazac)
LIMT (ile wybrac)

masz dwie konstrukcje. bazowanie na gotowcach nie zwalnia od zapoznania sie za manualem...
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 15:36