Jump to content

Recommended Posts

Hello there, I have a couple of questions and would appreciate any help.

 

1)

I have a basic news system running but on the list news items page, I would like to display a shortened version of the main body of the news item. i.e. if the text is over 150 characters then display a "(...More)" link at the end to the full item.

 

2)

When displaying the body text of the news items, I am using tables but if the body has a really long line of text, it extends the table. I would like to force a new line when the text reaches the edge of the table.

 

Thanks in advance,

 

Chris

You could limit the string to a set number of characters like this:

 

<?php

$string = "My text from whatever source":

$str= substr($string, 10); //The number limits your str to that many characters including spaces

echo "$str";

?>

Thanks for the quick reply. Just another quick one, when the are more than 10 items on the page, how do I then display the next 10 on another page.

 

Thanks again,

 

Chris

 

It's called pagination. Google for it and you'll find plenty of tutorials.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.