Wednesday, July 12, 2017

Read More Using PHP



 This tutorial enables you to set a limit of text characters of a description in an article. By doing that, we need to create a "Read More" link that will redirect the viewer to its full content.



Here is a simple tutorial to achieve "Read More.." link functionality.

1) To create link dynamically, we need first to create connection with the database and get all records with description from the database. In this case, we are extracting the whole content of each row on the table and we wanted to limit the texts to display.








2)  Now, we will be creating a general function called "readMore(...)" to display the link to its full content.

3) Create a file "story.php" where the full content of the story will be shown

After creating the code, main page will show the lists of stories/posts.




Clicking the "Read More" link redirects you to the full content of the story.


Well, that's it! We can now limit the text description of a story using this simple PHP function.


No comments:

Post a Comment

PHP IMAP - Get Emails from GMAIL

Fetching emails from your GMIAL account is easier than what you expected. With the use of PHP IMAP Extension, you can easily fetch your e...