Wednesday, March 7, 2012

Intro to news

Hi!

I want to show intro of the newest news on my startpage. But I only would like to show the subject and part of the message and if you klick on the subject you can se the whole news...how can I do that?

I have an mySQL database with the news.

I havn't found any thread with this topic...

Zäta1] Get list from DB of last say 5 news entries, Order By Date created DESC.
2] In same select get the first 10-15 characters of news item.
3] In same select get the subject field.

Put subject in a label control, in this case 5 of them.
Put News Item piece in a Link button control, 5 of them too :)

Whe user click on linkbtn control go get full item and display it.

return the SELECT results to a dataview and use that to fill the Labels and link btns.

There ya go.

Deasun|||Thanx!

But how do I select 10-15 characters, thats my problem...I don't know how to do that.
Can you shoe my the sql query or something?|||In SQL I believe the cmd your looking for is SUBSTRING(item, 1, 15)
Works like Mid() in VB.

Deasun
www.tirnaog.com

No comments:

Post a Comment