syntax hilighting

how do you make php do it?

Page 1 of 1

11 Replies - 1927 Views - Last Post: 22 March 2002 - 04:53 PM Rate Topic: -----

#1 JRGweb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-March 02

syntax hilighting

Posted 19 March 2002 - 10:32 PM

how do you make php syntax hilighted, like for code examples?


thanks fellas


Is This A Good Question/Topic? 0
  • +

Replies To: syntax hilighting

#2 iamcenz  Icon User is offline

  • You wish you were my hand!
  • member icon

Reputation: 7
  • View blog
  • Posts: 2,442
  • Joined: 26-March 01

Re: syntax hilighting

Posted 19 March 2002 - 11:03 PM

make a identical file and make the extention .phps ex:click here

(Edited by BluntedbyNature at 1:03 am on Mar. 20, 2002)

Was This Post Helpful? 0
  • +
  • -

#3 JRGweb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-March 02

Re: syntax hilighting

Posted 19 March 2002 - 11:07 PM

that's cool, but is there a way to actually get it to print out in in html? like in the middle of a document?
Was This Post Helpful? 0
  • +
  • -

#4 LammaDog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 114
  • Joined: 30-September 01

Re: syntax hilighting

Posted 20 March 2002 - 01:06 AM

I wanted to do that too,

I tried Include();     but it didn't work out very well for me.

one way would be to stick it in a frame.

if you figu....   wait....   what if you....    brb....  naw that wouldn't work

if you figure out a better way to do that,  let us all know

Was This Post Helpful? 0
  • +
  • -

#5 LammaDog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 114
  • Joined: 30-September 01

Re: syntax hilighting

Posted 20 March 2002 - 02:46 AM

hmmm....    putting a .phps file in a frame don't work either
Was This Post Helpful? 0
  • +
  • -

#6 LammaDog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 114
  • Joined: 30-September 01

Re: syntax hilighting

Posted 22 March 2002 - 02:57 PM

Ok, I got this figured out!

read and print the file!

$requesturl = "yourfile.phps";
$fp = fopen("$requesturl", "r");
while(!feof($fp)) {
$line .= fgets($fp,256);
}
fclose($fp);
print $line;


Was This Post Helpful? 0
  • +
  • -

#7 JRGweb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-March 02

Re: syntax hilighting

Posted 22 March 2002 - 04:26 PM

thanks lamma! Could you explain your code for me? If you can't or don't have time i understand, but it'd be really awesome if you could.

Thanks man

Was This Post Helpful? 0
  • +
  • -

#8 LammaDog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 114
  • Joined: 30-September 01

Re: syntax hilighting

Posted 22 March 2002 - 04:29 PM

$requesturl = "yourfile.phps"; // set your .phps file
$fp = fopen("$requesturl", "r"); // open it
while(!feof($fp)) { // start a loop that reads each line till the end of the file
$line .= fgets($fp,256); // read each line of the file and append it to $line
}
fclose($fp); // close the file
print $line; // print it to the browser


Was This Post Helpful? 0
  • +
  • -

#9 JRGweb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-March 02

Re: syntax hilighting

Posted 22 March 2002 - 04:34 PM

thaks man
Was This Post Helpful? 0
  • +
  • -

#10 Sargant  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 91
  • Joined: 30-November 01

Re: syntax hilighting

Posted 22 March 2002 - 04:47 PM

There's no need for any of that effort - just read the manual. The PHP function show_source('myfile.php') outputs the file and even colour-codes the syntax for you automatically.
Was This Post Helpful? 0
  • +
  • -

#11 JRGweb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-March 02

Re: syntax hilighting

Posted 22 March 2002 - 04:50 PM

wow even better! thanks man! instead of a php file, can you put in a variable with source in it?
Was This Post Helpful? 0
  • +
  • -

#12 LammaDog  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 114
  • Joined: 30-September 01

Re: syntax hilighting

Posted 22 March 2002 - 04:53 PM

OMFG!!!      hahahaaaaaa

I've been banging my head against the walls on this one for a week!      

oh well,  one of these days, I'll figure out what RTFM means

LMAOROF

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1