View Single Post
Old 04-12-2022, 05:13 PM  
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana. / Newcastle, England.
Posts: 1,123
One more quick php question

Im using the following on a page to limit the amount of characters are displayed for a products description:

Quote:
<?php

function custom_echo($x, $length)
{
if(strlen($x)<=$length)
{
echo $x;
}
else
{
$y=substr($x,0,$length) . '...';
echo $y;
}
}
?>
Followed by calling the shortened description like this:

Quote:
<?php custom_echo($row['style-info'], 100); ?>
It works perfectly however, I'm wanting to add this onto the end after the period marks:

... More

With a clickable link using a link setup this way:

domain.com/page.php?id=$ID

How would I go about editing the code I'm currently using to facilitate that?

I have tried adding the HTML code next to the periods but, that didnt work for some reason

Should I be using something different entirely?

Any help, pointers or advice would be appreciated.

Thanks
__________________
NOTHING TO SEE HERE
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote