Results 1 to 7 of 7

Thread: Possible to convert any Html page to PHP

  1. #1
    Join Date
    May 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Possible to convert any Html page to PHP

    Is this possible?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Probably. You mean the file extensions? Yes.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.)
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If not, it's treated like a .txt... shows the code.
    Depends how the browser's configured. Most will attempt to download the file.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    May 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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:
    Code:
    <?php for($i = 0; $i < 4; $i ++)
      echo("<p>$i</p>\n"); ?>
    ... the client will see:
    Code:
    <p>0</p>
    <p>1</p>
    <p>2</p>
    <p>3</p>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Most will attempt to download the file.
    Haven't played with it too much... safari decides its text. Or was it mozilla. Whatever.
    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
    But... yeah... it will hide php code.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •