Jump to content

parsing PHP


Recommended Posts

All you do to put php in a page is name it page.php

then put the php in the html document

EX

<html>
<head>
</head>
<body>
<?php
switch (rand(1 4)) {
case 1;
echo"we strive to help you!";
break;
case 2;
echo "Please check out our hosting forum.";
break;
case 4;
echo"We are now taking aplications.";
break;
}
?>

I think that is right for the most part.

 

Joe

 

Link to comment
Share on other sites

looking at my files again, it's really obvious that you CAN edit the .htaccess file...I use FileZilla, and after connecting to HelioHost I went to the folder public_html and the .htaccess file should be there...download it, edit it like that website says, and upload it again.

 

i just checked using the cPanel, and you can't see it from there. i don't know about what RK Web Designs said, but I didn't do anything special except connect using an FTP client (such as FileZilla - google it, its free)

 

i think you're checking through the cPanel, and it doesn't show up there. am i correct?

Link to comment
Share on other sites

.htaccess is a hidden file by default, if your using helio click on file manager and select show hidden files ;)

 

All files starting with a . are hidden files by default on Linux/Unix hosts.

Also for .htaccess to work it needs to be permitted in Apache's configuration file.

 

 

I don't really know why you would want to do what your doing though.

 

All that site does is tell the webserver anything ending in .html or .htm is a PHP file and should be treated as a PHP file.

You may aswell have used a .php file

 

What is normally more useful is to do that with a JPEG extension then you can have PHP generate an image file and put it in web forums which add there restrictions via the filename. If your really clever you can use Apache's url rewriting module to do things like turning http://www.example.com/banner/12/img.jpg into http://www.example.com/banner/img.php?id=12

but it can do it for any number without coding them seperately. Very use for allowing users to create banners and have then able to specify things like colour and size at whim.

 

 

There is of course a performance overhead from making Apache parse all HTML files as PHP, it needs to invoke the parse on each of them just for it to find they have no code in them, This can be avoided by putting all the HTML files that have PHP in them in a sub directory and moving the .htaccess file into that sub directory. Remember that a .htaccess file overides any .htaccess files closer to the root of the directory tree so repeat any other settings you had in .htaccess files.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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...