Welcome Guest, Not a member yet? Register   Sign In
What is the correct way to show small part and read more for an article in the main page?
#1

[eluser]ytsejam[/eluser]
Hello ,
I am a newbie. I want to learn how can i show a small part of an article in the main page. and put a read more link to show it in a seperated page?
#2

[eluser]minerbog[/eluser]
You could store an intro field for the fist page that only has a snippet of your main post in it.

Or, return the main article and strlen then variable to a shorter length.

If your asking if there is a library for it, then no, there's not. Its going to take some basic php skills to do that.

Gav
#3

[eluser]Aken[/eluser]
I would do it one of two ways:

1) As minerbog mentioned, you could add a specific "intro" field. This is helpful if you want your intro text to be used in other places except the main article page. Good for teaser lines and that sort of thing.

2) Assuming you're using MySQL, there is a built-in SUBSTRING() [ or SUBSTR() ] string function available that allows you to pull specific chunks of text. Great way to pull only the first X words of your article. You can then use PHP to remove any partial words at the end, in case your character limit ended mid-word (you could also go back to the end of a sentence).




Theme © iAndrew 2016 - Forum software by © MyBB