Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Odnośnik - Czytaj Więcej
Sign
post
Post #1





Grupa: Zarejestrowani
Postów: 128
Pomógł: 0
Dołączył: 3.11.2014

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


Cześć, mam system newsow i automatyccznie dadaje newsa, ale jednak chcialbym, aby tekst był uciety. Dajmy na to do 150 znakow, a nastepnie na dole pojawia się Czytaj Więcej i przekierowywuje mnie na strone z pelnym artykulem, jak to zrobic ?
http://signweb.xaa.pl/skrypt/news.php
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Sign
post
Post #2





Grupa: Zarejestrowani
Postów: 128
Pomógł: 0
Dołączył: 3.11.2014

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


// strip tags to avoid breaking any html
$string = strip_tags($string);

if (strlen($string) > 500) {

// truncate string
$stringCut = substr($string, 0, 500);

// make sure it ends in a word so assassinate doesn't become ass...
$string = substr($stringCut, 0, strrpos($stringCut, ' ')).'... <a href="/this/story">Read More</a>';
}
echo $string;
to w plik, ktory news wyswietla?
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: 17.10.2025 - 13:01