View Full Version : Intro on one page - full story on another - one update?

08-24-2006, 05:30 AM

I'm new to these boards - came across it in seach for an answer to my current problem.

I'm developing a website and on the front page I want a section that has "introductions" to extended news stories on another page and only having to update once.

So basically...

(front page section)
Short intro
Click here to read more link...

Short intro
Click here to read more link...

Short intro
Click here to read more link...

(News page)
Extended story

Extended story

Extended story

and only updating the news page.

I have no idea how to go about this.

Help?? thankyou in advace :)

08-24-2006, 03:09 PM
When you click on the "short intros", do they all then go to the same
page? (the full story page)? or does each short intro go to a full story
page that's only for that particular short intro?

And you won't be adding or editing stories?


Answer those questions and also look into this as a method to display
stories and easily edit them.

1) Change the extension of your HTML pages to .php
(example: index.html would now be index.php )

2) Use Notepad to create text files.
Name them something like:
news1_intro.txt news1_full.txt
news2_intro.txt news2_full.txt ... etc.

3) Upload those text files into the same directory as your .php pages.

4) Inside your .php pages, use this code to display your text files:
<p><?php include 'news1_intro.txt'; ?></p>
<p><?php include 'news2_intro.txt'; ?></p>

What's happening is that whenever a "php include" is executed, it
inserts the contents of whatever text file you're specifying.

How it's displayed depends on your HTML ... or if you use CSS.
You can format the paragraphs however you want.

So now, you only need to edit those text files and not your webpage.
You can change the text files whenever you want.

Inside all of the "intro" text files, you'll have the link to the other page(s).
Of course, you'll need to determine if you're going to have separate
pages for each story?

Example ... say this is: "news4_intro.txt"
More people will be vacationing at the coasts
this year than ever before.
<br><a href='nextpage.php'>more ...</a>

The link is actually put into the text file, and will
appear with the text paragraph.

08-24-2006, 08:04 PM
mlseim is on the right track but as you say you only want to update the article (as opposed to a preview file as well), I'd say look into using the substr() (http://uk2.php.net/substr) function in PHP (which would allow you to pull the 1st 100 characters (or however many you wanted) from the article to use as an intro).

Edit: Just found this which looks like it could help - http://www.fundisom.com/phparadise/php/string_handling/summarize_article