Jump to content

Database-driven Articles


doubledee

Recommended Posts

Normally you have something like articles.php and append a get query string to it.  You can then read the vars there and load the correct article from the db.

 

Goto articles.php?id=1

query db table articles where id = $_GET['id']

 

Not sure if that's what you're asking.

Link to comment
Share on other sites

Normally you have something like articles.php and append a get query string to it.

 

I am sooo confused the more I think about this all?!  :-\

 

Currently I have a home page of:

 

w w w.MyWebsite.com  (aka "index.php")

 

My articles can be found at:

 

w w w.MyWebsite.com/articles/how_to_create_dynamic_pages.php

 

w w w.MyWebsite.com/articles/using_mod_rewrite_automate_things.php

 

w w w.MyWebsite.com/articles/tips_for_secure_code.php

 

 

The articles are physical files I created and named and put in my "articles" directory.

 

----

 

So you are saying I would have a:

 

w w w.MyWebsite.com/articles/index.php

 

and then I would append onto it:

 

?id=1

?id=2

?id=3

 

Is that right?

 

 

I think where I am getting confused is how this conversation relates to my larger website.

 

Currently, I have a Home Page which is a hodgepodge of article-teasers, links etc.

 

Then I have an "Articles Home Page" which lists all of my articles by including a Heading, Thumbnail, Teaser Paragraph, and link to the actual article.

 

Like I said, right now, I have a physical file for each article and it is named something like "using_stylesheets_to_simplify_your_life.php"

 

How do I incorporate what you are talking about into all of this??

 

 

 

You can then read the vars there and load the correct article from the db.

 

Goto articles.php?id=1

query db table articles where id = $_GET['id']

 

Not sure if that's what you're asking.

 

 

 

Debbie

 

 

Link to comment
Share on other sites

This post should explain the theory. Just imagine however that the index.php referred to is your page which lists all your articles and then the profiles.php page is article.php used to display an individual article.

 

You could even further optimize this setup using mod_rewrite so that your articles still use links such as using_mod_rewrite_automate_things.php. You would need however to pass the article title through the url instead of a simple id.

Link to comment
Share on other sites

This post should explain the theory. Just imagine however that the index.php referred to is your page which lists all your articles and then the profiles.php page is article.php used to display an individual article.

 

I'm getting ready for bed, but on initial inspection, I think that example will be a big help!

 

 

You could even further optimize this setup using mod_rewrite so that your articles still use links such as using_mod_rewrite_automate_things.php. You would need however to pass the article title through the url instead of a simple id.

 

Ideally, I'd like to keep the same "look and feel" that I currently have, but leverage using MySQL.  That means I would have a page that lists articles with a short summary of each ("a_index.php"), and then each article would have a URL which is self-documenting (e.g. "w w w.MyWebsite.com/articles/switching_to_css3.php") and the URL would make it look like there is a file located ina an "articles" directory even though the article is now actually in my MySQL database.

 

How hard will that be to do?

 

 

Lastly, will you be online earlier in the day tomorrow?  (Not sure where you are located?)

 

I would *really* like to get this done tomorrow (or sooner) so I can get back to fixing my "Add a Comment to an Article" module?!

 

Thanks a bunch so far!!

 

 

 

Debbie

 

 

Link to comment
Share on other sites

How hard would it be to do? That really depends. This is the kind of thing I could knock together in about 5 - 10 minutes, your time may obviously vary though.

 

As for when I'll be on here, I'm on here quite allot. Though there are many people who could answer your questions.

Link to comment
Share on other sites

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.