Jump to content

Recommended Posts

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!!

Link to comment
https://forums.phpfreaks.com/topic/222263-need-help-finding-news-script/
Share on other sites

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.

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];

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.