|
Posted by NC on 12/15/05 02:45
frizzle wrote:
> NC wrote:
> >
> > First of all, it is entirely possible that HTML pages you are referring
> > to are in fact static. Some content management systems actually
> > separate writing, editing, and publication. An article can be
> > submitted by the author and stored in a database until the editor
> > approves its publication, at which point static HTML files are created
> > and publication's home page and RSS feeds are updated.
>
> how would you edit/update these?
You wouldn't. You would edit the articles stored in the database and
then re-publish (overwrite old static HTML files with new ones).
> > Now to your question. If you do decide to use mod_rewrite in the
> > above-described fashion, you can simply do something like this:
> >
> > if (is_numeric($_GET['article'])) {
> > $id = (int) $_GET['article'];
> > $query = "SELECT * FROM articles WHERE id=$id";
> > // Execute the query and display the article...
> > }
> > else {
> > $search = $_GET['article'];
> > switch $search {
> > case 'hot_news':
> > $query = "SELECT * FROM articles ORDER BY id DESC LIMIT 5";
> > break;
> > // more case statements here...
> > }
> > // Execute the query and display the article headers/teasers...
> > }
>
> And for your solution to my 'problem'; i meant how to handle DB-entries
> if not reffered to them as ID's, but as actual topic names ...
This is exactly what the above does. If $_GET['article'] is a number,
it is interpreted as an article ID, and the script shows full text of
the article. If it is not, it is interpreted as a topic identifier,
and the script displays only headers and/or opening paragraphs and
links to full text. Topic 'hot_news', in particular, includes five
most recent articles...
Cheers,
NC
Navigation:
[Reply to this message]
|