can i convert php code into html

Discussion in 'PHP' started by shwetaktm, Jan 28, 2008.

  1. #1
    Hello friends,
    Can i convert php code into html by any software.
     
    shwetaktm, Jan 28, 2008 IP
  2. Possibility

    Possibility Peon

    Messages:
    350
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Umm, what do you mean? PHP code can't be HTML, they are different languages. Do you mean that you want to display code snippets on a website of PHP code, and you need to be able to display it without it executing?
     
    Possibility, Jan 28, 2008 IP
  3. Dondon2d

    Dondon2d Peon

    Messages:
    3,193
    Likes Received:
    146
    Best Answers:
    0
    Trophy Points:
    0
    #3
    No, in that case the functions would not work. Unless you only want the "output" :)
     
    Dondon2d, Jan 28, 2008 IP
  4. sunnyverma1984

    sunnyverma1984 Well-Known Member

    Messages:
    342
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    120
    #4
    no becouse php is server site programming laguage and html is client site markup laguage
     
    sunnyverma1984, Jan 29, 2008 IP
  5. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #5
    Why would you want to do that? You can't anyways...
     
    Kaizoku, Jan 29, 2008 IP
  6. dmcybox

    dmcybox Banned

    Messages:
    225
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I also have that problem, If you really want to convert it..try to decode it manually using dreamweaver. :D
     
    dmcybox, Jan 15, 2009 IP
  7. artiskool

    artiskool Peon

    Messages:
    34
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Did you mean PHP code output to HTML? If so, the answer is YES. You can convert the output of php code to html in this way:
    
    $string = file_get_contents('http://yourdomain/yourphpfile.php'); // you can also use the absolute filename or even traverse the entire directory of your php scripts. NOTE: If you are using an absolute filename as parameter you might be converting you php code to html code by code and not the output
    file_put_contents('yourhtmlfile.html', $string);
    
    PHP:
     
    artiskool, Jan 15, 2009 IP
  8. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #8
    php outputs html by itself.. its not possible to change php codings into html atleast the functions part
     
    Bohra, Jan 18, 2009 IP
  9. artiskool

    artiskool Peon

    Messages:
    34
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    It is possible to change the php codings into html using the highlight_* families

    if you want to convert string php code use highlight_string and if it is file use highlight_file
     
    artiskool, Jan 19, 2009 IP
  10. fatedesign

    fatedesign Peon

    Messages:
    38
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    lol, NO, but if your asking for a .php file into a .html then...

    <?php
    $oldFile = $_POST['file'].".php";
    $newFile = $_POST['file'].".html";
    rename($oldFile, $newFile);
    ?>
     
    fatedesign, Jan 21, 2009 IP
  11. t3nt3tion

    t3nt3tion Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    You could possibly have php files read as html.
    You`d need to add a mime setting. I`m sure that would fix your issues.
    Or you could use a mod_rewrite to change the ending to .html
     
    t3nt3tion, Jan 22, 2009 IP