Hi all hope you will be fine
I am creating a article site in this site i want to put some text on main page and link it via "read more" text from articles page and complete article will be present on article file/page how to do that.
article site help remaining text
Moderator: General Moderators
-
dhenick
- Forum Newbie
- Posts: 19
- Joined: Tue Oct 20, 2009 10:46 am
- Location: Yogyakarta, Indonesia
- Contact:
Re: article site help remaining text
may be this function can help you.
Jus call that function like this
you can visit my blog for detail at http://dhenick.web.id/?p=7 
Code: Select all
function putusHubungan($sumber,$jumlah){
if(strlen($sumber) >= $jumlah){
$putusanAwal = substr($sumber,0,$jumlah);
$cariSpasiTerdekat = strpos($sumber," ",$jumlah);
$putusanAkhir = substr($sumber,0,$cariSpasiTerdekat)." ....</div>";
}else {
$putusanAkhir = $sumber;
}
return $putusanAkhir;
}
$sumber = source of your article.
$jumlah = how many character will be show on that page
Code: Select all
$source = "This is long description of article, i will cut this description.",
echo putusHubungan($source,10);
And the out put is like this
This is long description .....