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 (1 - 4)
Aqu
post
Post #2





Grupa: Zarejestrowani
Postów: 279
Pomógł: 58
Dołączył: 14.07.2012

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


http://stackoverflow.com/questions/4258557...-read-more-link
Go to the top of the page
+Quote Post
Sign
post
Post #3





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
Aqu
post
Post #4





Grupa: Zarejestrowani
Postów: 279
Pomógł: 58
Dołączył: 14.07.2012

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


Tak, $string to zmienna z treścią newsa.
Go to the top of the page
+Quote Post
Sign
post
Post #5





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

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


Troche nie rozumiem, móglby to ktos jasniej wytlumaczyc, co zrobic, zbey po kliknieciu czytaj dalej przenosilo na strone, ktora jest automatycznie tworzona razem z newsem?

Jak już dodalem ten kod co wyzej podalem, to co dlaej mam robic ?
Go to the top of the page
+Quote Post

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: 8.10.2025 - 09:50