Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> BBcode na stronie
Misiuu
post 5.07.2011, 16:48:20
Post #1





Grupa: Zarejestrowani
Postów: 76
Pomógł: 0
Dołączył: 13.10.2009

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


Witam, posiadam forum phpbb by przemo. Napisałem skrypt który pokazuje pierwsze posty w temacie w forum o danym id itp.
Wszystko działa tylko chciałbym żeby ten skrypt pokazywał też bbcode na stronie.
Pisałem na ich forum to podali mi coś takiego
  1. include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
  2. $bbcode_uid = $row123['bbcode_uid'];
  3. if ( $bbcode_uid != '' )
  4.  
  5. {
  6. $message = ($board_config['allow_bbcode']) ? bbencode_second_pass($row123['post_text'], $bbcode_uid,
  7.  
  8. $userdata['username']) : preg_replace("/\:$bbcode_uid/si", '', $row123['post_text']);
  9. }


niby działa, jednak pojawia się tylko 1 news z 3 i pod tym 1 pojawia sie błąd i rozwala pół strony.

cały skrypt wygląda tak :



  1. <?php
  2. include('site/connect.php');
  3. $result = mysql_query("SELECT bbcode_uid, post_time, user_id, username, b.post_id, post_subject, b.post_text
  4. FROM phpbb_users, phpbb_posts AS a, phpbb_posts_text AS b, phpbb_topics AS t
  5. WHERE poster_id = user_id AND a.forum_id = 1
  6. AND a.post_id = b.post_id
  7. AND a.post_id = t.topic_first_post_id
  8. ORDER BY a.post_id DESC
  9. LIMIT 3");
  10.  
  11. if(mysql_num_rows($result) > 0) {
  12. while($row123 = mysql_fetch_assoc($result))
  13. {
  14.  
  15. include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
  16. $bbcode_uid = $row123['bbcode_uid'];
  17. if ( $bbcode_uid != '' )
  18.  
  19. {
  20. $message = ($board_config['allow_bbcode']) ? bbencode_second_pass($row123['post_text'], $bbcode_uid,
  21.  
  22. $userdata['username']) : preg_replace("/\:$bbcode_uid/si", '', $row123['post_text']);
  23. }
  24.  
  25. $time = date("d-m-Y H:i:s", $row123['post_time']);
  26.  
  27.  
  28.  
  29. echo '<div class="tekst"><table class="table1" cellspacing="0" summary=""><tr><td><h1 class="ng"><a
  30.  
  31. href=forum/viewtopic.php?p='.$row123['post_id'].'>'.$row123['post_subject'].'</a></h1><code>Post napisany :
  32.  
  33. <b>'.$time.'</b></code></td></tr><tr><td><p>'.$message.'</p></td></tr><br><br><th>Post napisany przez:<font
  34.  
  35. color=blue> <a href=forum/profile.php?mode=viewprofile&u='.$row123[user_id].'>'.$row123['username'].'</a></font>
  36. </a>
  37. </a></th></table></div><br><center><img src="images/pasek2.PNG"></center>';
  38. }
  39. }
  40.  
  41.  
  42. ?>



a tutaj jest treść wyżej wymienionego błędu

Cytat
Fatal error: Cannot redeclare load_bbcode_template() (previously declared in D:\Program Files\WebServ\httpd\forum\includes\bbcode.php:47) in D:\Program Files\WebServ\httpd\forum\includes\bbcode.php on line 45
Go to the top of the page
+Quote Post
proton
post 5.07.2011, 21:08:42
Post #2





Grupa: Zarejestrowani
Postów: 88
Pomógł: 4
Dołączył: 16.08.2006

Ostrzeżenie: (20%)
X----


Witam

Zamień ten fragment:

  1. if(mysql_num_rows($result) > 0) {
  2. while($row123 = mysql_fetch_assoc($result))
  3. {
  4.  
  5. include($phpbb_root_path . 'includes/bbcode.'.$phpEx);


na:

  1. if(mysql_num_rows($result) > 0) {
  2. include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
  3. while($row123 = mysql_fetch_assoc($result))
  4. {


Skrypt bbcode powinieneś ładować tylko raz, a tak to ładowałeś go za każdym razem.
Go to the top of the page
+Quote Post
Misiuu
post 7.07.2011, 12:10:10
Post #3





Grupa: Zarejestrowani
Postów: 76
Pomógł: 0
Dołączył: 13.10.2009

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


jeeejku , działa exclamation.gif

a jak zrobić żeby enter w poście interpretowało jako <br> ?
Go to the top of the page
+Quote Post
nospor
post 7.07.2011, 12:10:52
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




http://pl.php.net/manual/en/function.nl2br.php


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

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: 18.06.2025 - 22:34