Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 109,583 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 1,530 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



view source code of Php file and convert it into a Html file

 
Reply to this topicStart new topic

view source code of Php file and convert it into a Html file

Eltrusko
post 8 May, 2008 - 11:17 AM
Post #1


New D.I.C Head

*
Joined: 8 May, 2008
Posts: 4

how to view and use source code(browser generated output) so that i can convert it into a html file...plz relpy
User is offlineProfile CardPM

Go to the top of the page


MitkOK
post 8 May, 2008 - 11:32 AM
Post #2


D.I.C Regular

Group Icon
Joined: 9 Aug, 2007
Posts: 281



Thanked 9 times

Dream Kudos: 225
My Contributions


http://bg2.php.net/highlight_file
User is offlineProfile CardPM

Go to the top of the page

Eltrusko
post 9 May, 2008 - 02:05 AM
Post #3


New D.I.C Head

*
Joined: 8 May, 2008
Posts: 4

QUOTE(MitkOK @ 8 May, 2008 - 11:32 AM) *




to view a source code....it works fine...
but how should i use it..to convert it as a text file.....???
User is offlineProfile CardPM

Go to the top of the page

Eltrusko
post 9 May, 2008 - 05:06 AM
Post #4


New D.I.C Head

*
Joined: 8 May, 2008
Posts: 4

QUOTE(Eltrusko @ 9 May, 2008 - 02:05 AM) *

QUOTE(MitkOK @ 8 May, 2008 - 11:32 AM) *




to view a source code....it works fine...
but how should i use it..to convert it as a text file.....???



i have written code depicted below.....but it does not work any more....
actually i m doin my project on "Web page Publication " which is just like as
Microsoft office publisher and geocities.com web hosting.....thats why i need
to insert cms and this one.
by da way......the code:-

CODE



    
    
  <?php
function highlight_with_linenum($file)
{
    //open handle, set vars
    $handle = fopen($file, "r");
    $count = 1;
    $lines = "";

    //look line ends
    while ($thisone = fread($handle, "1"))
    {
        if ($thisone == "\n")
        {
            //add number
            $lines .= $count . "<br />";
            $count++;
        }
    }  
    //close handle
    fclose($handle);

    //highlight contents
    $contents = highlight_file($file, TRUE);
      
    //print output (you could as well return now)


     $soumen_file=fopen("h.txt","w+");
     chown("h.txt","charles")

      $len=strlen($content);

      $len1=0;
     while($len1!=$len)
    {
       $len1=$len+1;
       gets("$content");
       puts("h.txt","a+");

    }
    fclose($soumen_file);
      


//echo "Succesfully copied in txt file","h.txt";







//copy('$contents','h.txt');

    fclose($soumen_file);


   // print '<table><tr><td><code>' .
     //     $lines . '</code></td><td>' .
      //    $contents . '</td></tr></table>'




}

    highlight_with_linenum("yourpage_prj_goin.php");


?>

plz reply

User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/8/08 12:39AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month