Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> wyswietlanei z funkcji w zlym miejscu
remik09
post
Post #1





Grupa: Zarejestrowani
Postów: 102
Pomógł: 10
Dołączył: 25.12.2005
Skąd: Ruda Śląska

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


mam kod
  1. <?php
  2. function tnij ($cos_do_obciecia, $ile_znakow) {
  3. if (strlen($cos_do_obciecia) > $ile_znakow) {
  4. $obciete = substr($cos_do_obciecia,0,$ile_znakow);
  5. $tresc = $obciete.'...';
  6. } else {
  7. $tresc = $cos_do_obciecia;
  8. }
  9. print $tresc;
  10. };
  11.  
  12. function wyswietl_news ($tytul, $data, $tresc) {
  13. print '
  14. <a href="#"><strong>'.$tytul.'</strong></a> Data dodania: '.$data.'</a><br />
  15. <small>'.$tresc.'</small><br /><br />
  16. ';
  17. };
  18. $wynik = mysql_query("SELECT * FROM news ORDER by id DESC")
  19. or die('B��d zapytania');
  20. while($r = mysql_fetch_assoc($wynik)) {
  21. $zdanie = $r['tresc'];
  22. $wyswietl = tnij($zdanie, 300);
  23.  
  24. print wyswietl_news($r['tytul'], $r['data'], $wyswietl);
  25. }
  26. ?>


i wychodzi z tego

  1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur lectus leo, venenatis sed, rhoncus vitae, tincidunt in, lacus. Aliquam erat volutpat. Ut nunc. Nulla non nisi quis eros pellentesque hendrerit. Mauris sollicitudin. Nulla nonummy tellus ultricies libero. Nulla at arcu in felis conse...
  2. <a href="#"><strong>Lorem ipsum</strong></a> Data dodania: 11:17 08-2-2008</a><br />
  3. <small></small><br /><br />


Czyli tresc jest w trszke innym miejscu niz ma, ma ktos pomysl dlaczego ?
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 25.08.2025 - 04:46