auto generated pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pachox
Forum Newbie
Posts: 23
Joined: Sun Aug 17, 2003 7:14 am

auto generated pages

Post by pachox »

i have a db lthat i want to publish. it''s full of articles and i want it to work this way:

there are ten categories (sex, health,....)
once you click one of this category you go to a page where there are some articles (about sex, about health,...).

at this point is my problem. i'd like to find a way to click an article and have the code generating a new page for me with that article. is this possible?

to eplain:
this is sexuology.php with these:
article 1
article 2
article 3

once i click a new page is generated on the fly to let me read the whole article
how can i do,
pacho
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

First you need a view article script. At its simplest, this would take an article id and then query the database to get the article data. If access to articles is restricted in any way (say to registered members of your site only) you need to perform a check for that as well. There could be other tasks like a views counter - and you probably want to check the article id does in fact exist (it might have been deleted, or you might have some speculative query string tampering).

To view an article, just hyperlink the title - or a "view article" button, whatever. The hyperlink calls the view article script, passing the article id via GET.
Post Reply