Is this possible?
Printable View
Is this possible?
Probably. You mean the file extensions? Yes.
php and html are completely the same, EXCEPT for one thing:
Anything between <?php and ?> tags is parsed (as php) and then outputted as html.
Example:
IF ANY OF THE FOLLOWING LINES WERE "test.php":
<?php echo "<html><body>test</body></html>"; ?>
<html><?php echo "<body>test</body>"; ?></html>
<html><body>test</body></html>
You would see the same exact output.
And, yeah, like Twey says, you can just rename the file extension.
the only catch to that is that *I think* (in most cases at least) your server must be php enabled (installed/turned on) for even a pure html page with extension .php to work. If not, it's treated like a .txt... shows the code.
(random note... .phps extension shows the source code, if you want that instead.... should show html source too, I suppose.)
Depends how the browser's configured. Most will attempt to download the file.Quote:
If not, it's treated like a .txt... shows the code.
Sorry, I wasn't clear enough. I acutually meant to convert the client side page to a server side page, so people who visit your website can't possible steal your code.
I don't think you quite understand the model :)
Server-side scripts send all the client-side code to the client anyway. It's only the purely server-side code, such as database operations, that doesn't get output. The output of that code, however, does.
For example, if you have:... the client will see:Code:<?php for($i = 0; $i < 4; $i ++)
echo("<p>$i</p>\n"); ?>
Code:<p>0</p>
<p>1</p>
<p>2</p>
<p>3</p>
Haven't played with it too much... safari decides its text. Or was it mozilla. Whatever.Quote:
Most will attempt to download the file.
It won't display as html either way.
If you are talking about converting client side scripting, such as javascript, it's possible... but the syntax varies, so you'd have to go through command by command and be sure all of the operations-- especially the functions-- are supported by php.
the languages are similar in general structure/method, though, so the framework of the script could still get you there... just would need some reworking.
As for hiding your source, no, nope, not gonna happen.
Except the php code itself... output will be seen.
now... using php instead of javascript (where they can be switched... nothing that changes without refreshing, at least) would hide your scripts' source... but only for scripts.
that might be useful.
Like.. a script that gets the current time.
then again... not like that is so secret :p
But... yeah... it will hide php code.