Page 1 of 1
article site help remaining text
Posted: Mon Oct 26, 2009 1:12 am
by Naeem
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.
Re: article site help remaining text
Posted: Mon Oct 26, 2009 4:57 am
by dhenick
may be this function can help you.
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
Jus call that function like this
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 .....
you can visit my blog for detail at
http://dhenick.web.id/?p=7 