• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Displaying each result on its own page?

Guest
Apr 18, 2012 Apr 18, 2012

Copy link to clipboard

Copied

I'm creating a blog based on a guestbook format.

Basically at the moment I have an 'Add Post' page, that stores the post details in a database and then when you go to the index page all of the posts, including author name etc. are dumped in order.

But I want it to be more like a blog, how do I go about displaying each individual entry on it's own page. So the posts are listed on the main page, you click the title and it brings you to a page displaying only that post?

And another question, how would I go about displaying five posts on the index page rather than all of them? And then being able to click an 'older posts' link to see the previous five posts?

Thanks.

Views

686

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Apr 18, 2012 Apr 18, 2012

Hi,

You create a new cfm page whose responsability is only to display the post...lets call it display.cfm.

This page needs the ID of the post...an ID that is related to the database entry (can be you primary key in the table that you are storing the posts).

All you have to do for this page to have the necessary info to display the post is pass a parameter in the URL (called query string)...something like this <base_url_here>\display.cfm?id=1

You get this ID...select the post with this ID from the da

...

Votes

Translate

Translate
Guest
Apr 18, 2012 Apr 18, 2012

Copy link to clipboard

Copied

Hi,

You create a new cfm page whose responsability is only to display the post...lets call it display.cfm.

This page needs the ID of the post...an ID that is related to the database entry (can be you primary key in the table that you are storing the posts).

All you have to do for this page to have the necessary info to display the post is pass a parameter in the URL (called query string)...something like this <base_url_here>\display.cfm?id=1

You get this ID...select the post with this ID from the database and you are done.

In your main page, you must create the link to this page dynamically as the id will change for every entry.

So the display page is allways the same but the contents change according to the ID passed in the query string.

Regarding the five post display....

You can do it in the select to the database...or if you have an array of entries you display only the first 5

Then you have a link...to the same page perhaps with a different query string that displays all of them....

If you have any other doubts just ask.

Regards.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 18, 2012 Apr 18, 2012

Copy link to clipboard

Copied

LATEST

It worked so well, thank you very much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation