traumatic wrote:Sincere condolences!srod wrote:Code: Select all
System Windows NT IIS6110 5.2 build 3790
php question
I think you misunderstand the purpose of the <?php... ?> tag.
This tag is meant to be used in a .php or other file type that's recognized by the web server. A .php file is no different from a .html file other than the fact that it passes through the php parser. The parser knows what to act upon by what is encased in php tags.
To use the php tags in a .html file is backwards thinking. Just name your files .php.
A good book on PHP is Sam's Teach Yourself PHP in 24 Hours.
This tag is meant to be used in a .php or other file type that's recognized by the web server. A .php file is no different from a .html file other than the fact that it passes through the php parser. The parser knows what to act upon by what is encased in php tags.
To use the php tags in a .html file is backwards thinking. Just name your files .php.
A good book on PHP is Sam's Teach Yourself PHP in 24 Hours.
The <?php ?> tags can be embedded in ANY file which is passed to the php engine; anything not enclosed within such tags is ignored by the engine. My problem is getting my remote server to pass html files to the php engine; with Apache - no problem. With IIS...
There are good reasons for wishing to embed php code within a html file; as explained in Sam's Teach Yourself PHP, MySQL and Apache!
Now, I need a php script to run immediately before my main page loads in a user's browser. The options, in the absence of the desired solution of having html pages sent to the php engine, therefore, are either to rename my main page www.MyWebsite/index.php which is pretty horrendous for a user having to type that in, or use redirection - which is what I've done. The redirection works very well.
Course, if the user has disabled scripting...
There are good reasons for wishing to embed php code within a html file; as explained in Sam's Teach Yourself PHP, MySQL and Apache!
Now, I need a php script to run immediately before my main page loads in a user's browser. The options, in the absence of the desired solution of having html pages sent to the php engine, therefore, are either to rename my main page www.MyWebsite/index.php which is pretty horrendous for a user having to type that in, or use redirection - which is what I've done. The redirection works very well.
Course, if the user has disabled scripting...
I may look like a mule, but I'm not a complete ass.
The php parser can read tags from any file type passed to it, yes, but for what reason do you need it to read .html?
Apache will load an index page by order of importance .html/.php/.htm, in that order.
I'm going to guess that you can't get your index page redirected to simply by typing your website name? If you already have an index.html file in your website's root directory your php page won't load first.
Maybe I'm not understanding the question. Why is it imperative that your web pages have the .html extension?
You shouldn't have to. I can't speak for IIS but Apache will automatically recognize your index.php page by typing just www.MyWebsite.com, unless you have a conflicting index.The options, in the absence of the desired solution of having html pages sent to the php engine, therefore, are either to rename my main page www.MyWebsite/index.php which is pretty horrendous for a user having to type that in, or use redirection ..
Apache will load an index page by order of importance .html/.php/.htm, in that order.
I'm going to guess that you can't get your index page redirected to simply by typing your website name? If you already have an index.html file in your website's root directory your php page won't load first.
Only for those users who have Javascript enabled.The redirection works very well.
Maybe I'm not understanding the question. Why is it imperative that your web pages have the .html extension?
Well bugger me, I didn't know that -and yes, that works fine! Very nice.You shouldn't have to. I can't speak for IIS but Apache will automatically recognize your index.php page by typing just www.MyWebsite.com, unless you have a conflicting index.
Now why the hell didn't I think of even trying that?
That's what it means to be new to all of this Apache and php stuff!
Thanks Mistrel.
I may look like a mule, but I'm not a complete ass.
-
LuCiFeR[SD]
- 666

- Posts: 1033
- Joined: Mon Sep 01, 2003 2:33 pm
Sorry Lucifer, I think you were indeed saying that I should simply use index.php instead of index.html, but I didn't realise even then that the php file would be loaded automatically if the html file was absent!
And I have no excuse because I hadn't touched a drop!
And I have no excuse because I hadn't touched a drop!
I may look like a mule, but I'm not a complete ass.
-
PurePWNRER
- User

- Posts: 45
- Joined: Mon Mar 27, 2006 5:44 am
And you came from the past?, IIS supports .htaccess, mate.traumatic wrote:I'm not sure if I fully got this right, but if it's a windows server chances are
high that it's not even running apache but IIS instead.
If so, there's no .htaccess available.
If the server is running apache, your provider should really allow you to
access the .htaccess. I've never come across any provider that forbids
that. I mean, how do you setup error-documents for example?
:/ My kingdom for a snippet!
I might bash, But I provide.
I might bash, But I provide.
Well, PurePWNRER has been back and pooped on a few more doorsteps. Wonder why he hasn't responded here.traumatic wrote:Does it, mate? Since which version, mate? Do you have any link for me to read, mate?PurePWNRER wrote:And you came from the past?, IIS supports .htaccess, mate.
Maybe he is hunting down that link for us. We wait in anxious anticipation!
BTW, wouldn't it be great if IIS supported something like that? Save on all that manual or scripting pooting around. But then perhaps it would all be too easy.
Dare2 cut down to size

