Tulkas
11-03-2002, 07:41 PM
I already have a form where the user inputs news, articles and such and then encodes the info in the database. Then I can access the info by querying the database and show it to a page that accesses the database ("readsection.php?article=1&page=2")
But now Im thinking of making every article and news into a totally different page like (readsection-1-4-2002.html).
Is there a way to do this with PHP?
Rich2k
11-03-2002, 07:48 PM
Yes however not necessarily quite like that.
Using a nifty feature on apache and mod_rewrite you can do
domain.com/readsection/article/1/page/2/
or something like that
where readsection is your PHP file without the .php and then you just work out from the query string the relevant ids.
MarkIL
11-03-2002, 07:48 PM
Uhmm, sure. You could just run a query, say, every hour that extracts the news and articles from the DB and generates standalone HTML files.
Shouldn't be too hard.
EDIT: Or you could follow the previous poster's advice ;)
Rich2k
11-04-2002, 05:22 AM
On the subject of removing file extensions and being able to use .htaccess to tell Apache it's a php file... has anyone yet figured out how to do the same on IIS... I've looked and looked and looked... searches, msdn, technet... not there.
jtrovato
11-04-2002, 08:30 AM
I'll tell you, I do like IIS but!! I have notice that it's so much easier to do things with apache...
You could create .html file with php and store them on the server in any folder configuration you would like. You would have to create an ASCII file and basically write to that file all the html tags and then save it as anything you would like.
Although I feel that one of the purposes of PHP is to have dynamic HTML from one .php file. This way you save space and it's truly dynamic. I'm not sure the reason behind the static pages but I'm sure you have a good one.
John
beowulfdk
11-24-2002, 09:34 PM
Benefit of .html / .shtml static interface: Search engines more willing to index your site (better page ranking I think, and some search engines just dont index an url with ? in it)
Benefit of using an apache rewrite to make it appear your site contents is static files: Easy!
Benefit of generating the whole site as static html pages: The two above + less CPU time load.
Ofcourse the last option requires quite a bit more programming (and there is some issues regarding file permissions that has to be set/handled properly,+ it uses more discspace), but for sites with HUGE amounts of traffic it can greatly reduce CPU load. One downfall is that it isn't really a good solution if your contents is changing constantly, then one should use the rewrite solution or queries.
my 2 cents.
Rich2k
11-25-2002, 06:03 AM
Originally posted by jtrovato
I'll tell you, I do like IIS but!! I have notice that it's so much easier to do things with apache...
I know, but you don't always get the choice when it's not your decision to make. (I use both Apache and IIS BTW).
However what I want to know is how to remove a file extension from a file and still execute it as PHP. In Apache this is incredibily simple, however I cannot find any documentation on how to do the same on IIS.