Call-911 Posted December 21, 2010 Share Posted December 21, 2010 Hey All, I need some help finding a good news script, or at least a push in the right direction. What I need to do: Have a database for news stories. Make a basic CMS where the client can upload a title, picture, and the news story. Have the news story display on the "home page" with just the title and a small except of the story (maybe 100 words) On the news page, have a "read more" option, that when clicked links to another page where it has the whole story and picture. I can figure out the CMS stuff, I've done that before. What I don't get is the "read more" function. I can figure out how to link up a page to a database, draw the most recent story, and display the first 100 words. I just can't figure out how to make a "Read More" function where it will link to a different page that has the whole story. Obviously I don't want a million different pages, so I just want one page that will display different database information depending on what news story is clicked. I hope that makes sense. Maybe I am wording it wrong or am looking for the wrong thing. Any help would be appreciated. A tutorial would be wonderful, but I'll take any help I can get. This seems like it should be easy, but I'm just missing something... Thanks!! Quote Link to comment Share on other sites More sharing options...
Philip Posted December 21, 2010 Share Posted December 21, 2010 Take a look at Wordpress Quote Link to comment Share on other sites More sharing options...
laffin Posted December 21, 2010 Share Posted December 21, 2010 I think wordpress wud be too overwhelming for a beginner. wuts hard to believe is: I can figure out how to link up a page to a database, draw the most recent story, and display the first 100 words. I just can't figure out how to make a "Read More" function where it will link to a different page that has the whole story. Usually these Read More pages have a number of headlines and stories Headline 1... Read More Headline 2... Read More Headline 3... Read More and all a read more is a single page which uses a parameter in the uri http://my.site.com/readstory.php?id=xxx the readstory.php would use $_GET for the story id and display that one story. if you want examples, try a site such as http://www.hotscripts.com there are plenty of sites that have simpler systems than wordpress. Quote Link to comment Share on other sites More sharing options...
Adam Posted December 21, 2010 Share Posted December 21, 2010 Wordpress it too overwhelming for a beginner, really? All you do is upload the files and follow the instructions. Usually these Read More pages have a number of headlines and stories Headline 1... Read More Headline 2... Read More Headline 3... Read More I think what he means is how to display a sub string of the article. You can use the PHP function substr for that (there's also a MySQL substring() function you could use) , but you're likely to end up with words cut off mid-way. You're best off using regex to match x amount of whole words, using <space> as a delimiter: preg_match('/^(\S+\s+){0,100}/', $str, $matches); echo $matches[0]; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.