Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php][forum ipb]Lekka modernizacja wyciągania tematów ostatnich
fredzio90
post 31.08.2007, 20:27:58
Post #1





Grupa: Zarejestrowani
Postów: 251
Pomógł: 0
Dołączył: 19.02.2007

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


otóż znalazłem kod który wyciąga ostatnie tematy z forum ipb, bo chcialem dać na stronę...
i prezentuje się on tak:

  1. <?php
  2. $con = mysql_connect('localhost', 'xx', 'xx') or die(mysql_error());
  3. $intIle='5'; // ilość wyświetlanych tematów
  4. $strPfx='ibf_';//prefix tabel Invision
  5. $strFor='8'; //numer forum z ktorego maja byc pobierane dane
  6. $r=mysql_query('SELECT tid,title,posts,last_poster_name
  7. FROM '.$strPfx.'topics 
  8. WHERE forum_id='.$strFor.'
  9. ORDER BY last_post DESC
  10. LIMIT 0,'.$intIle.'')or die(mysql_error());
  11. while($row=mysql_fetch_array($r)){
  12. $strT=$row['title'];
  13. if (strlen($strT)>20)
  14. {
  15. $strT = substr( $strT, 0, 17 ) . '...'; 
  16.  
  17. }
  18. echo '<a href="http://ADRFORUM/index.php?index.php&amp;showtopic='.$row['tid'].'&amp;view=findpost" title="'.$row['title'].'">'.$strT.'</a>('.$row['posts'].')'.$row['last_poster_name'].'<br />';
  19.  
  20.  
  21. }
  22. ?>


i czy ktoś mógłby mi powiedzieć jak mógłbym także z danego forum wyszukiwać posty z danych SUBFÓR questionmark.gif?

bo mam forum: ogolne i subfora:
testy
inne
itp.. aktualnie wyciąga tylko z forum ogólne, a chciałbym żeby także z tych podkategori głównego forum wyciągało... czy ktoś pomógłby ?biggrin.gif

Ten post edytował fredzio90 31.08.2007, 20:28:25
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
-Wieviór-
post 1.09.2007, 07:56:48
Post #2





Goście







  1. <?php
  2. $strFor='8'; //numer forum z ktorego maja byc pobierane dane
  3. ?>


Po prostu sprawdź w bazie danych, jakie id ma dane subforum i ustaw.
Go to the top of the page
+Quote Post
fredzio90
post 1.09.2007, 08:46:47
Post #3





Grupa: Zarejestrowani
Postów: 251
Pomógł: 0
Dołączył: 19.02.2007

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


poradzono mi zrobić tak:

  1. <?php
  2. $con = mysql_connect('localhost', 'xx', 'xx') or die(mysql_error());
  3. $intIle='5'; // ilość wyświetlanych tematów
  4. $strPfx='ibf_';//prefix tabel Invision
  5. $strFor=array('8', '9', '10'); //numer forum z ktorego maja byc pobierane dane
  6. $r=mysql_query('SELECT tid,title,posts,last_poster_name
  7. FROM '.$strPfx.'topics
  8. WHERE forum_id='.implode(' OR forum_id=', $strFor).'
  9. ORDER BY last_post DESC
  10. LIMIT 0,'.$intIle.'')or die(mysql_error());
  11. while($row=mysql_fetch_array($r)){
  12. $strT=$row['title'];
  13. if (strlen($strT)>20)
  14. {
  15. $strT = substr( $strT, 0, 17 ) . '...';
  16.  
  17. }
  18. echo '<a href="http://ADRFORUM/index.php?index.php&showtopic='.$row['tid'].'&view=findpost" title="'.$row['title'].'">'.$strT.'</a>('.$row['posts'].')'.$row['last_poster_name'].'<br />';
  19.  
  20.  
  21. }
  22. ?>


i ładnie wszysko działa, jakby co może komuś się przyda
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 Wersja Lo-Fi Aktualny czas: 19.07.2025 - 17:29