RE: How does the PHP website colorize the code snippets?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 15 Nov 2007 03:40:32 -0800, "Daevid Vincent" <daevid@xxxxxxxxxx>
wrote:
>> -----Original Message-----
>> From: T.Lensselink [mailto:dev@xxxxxxxx] 
>> Sent: Thursday, November 15, 2007 12:05 AM
>> 
>> On Wed, 14 Nov 2007 23:45:40 -0800, "Daevid Vincent" <daevid@xxxxxxxxxx>
> wrote:
>> > I want to put a code snippet section on my site and want to 
>> > colorize them like the user comments on any PHP site page.
>> > 
>> > http://www.php.net/manual/en/language.operators.arithmetic.php
>> > 
>> > What's the easiest way to do that?
>> > 
>> > I've used Geshi, but that seems a lot of overhead just to 
>> > colorize a wee bit-o-PHP code.
> 
>> Take a look at highlight_string or highlight_file. 
>> 
>> http://nl3.php.net/manual/en/function.highlight-string.php
>> http://nl3.php.net/manual/en/function.highlight-file.php
> 
> 
> Worked pretty good. It seems to have trouble with the \ and \\ chars for
> some reason, but close enough for jazz as they say... (notice the array
has
> \\ when it should only be a single one, however if I get that to work,
then
> the color coding after it is messed up and the \n don't show up. Grr.)
> 
> Czech out http://daevid.com  "Free Code > Code Snippets"

Looks good. I also didn't get the exact result i was looking for. But hey..
it's a start.

> 
> I think the little curled corners are slick too!
> PHP.net, you're free to borrow my idea/CSS for your website if you like
:D

Dragable boxes are nice. Wish i had some time to work on my site :)

> 
> Now if only the colorize/highlight functions worked on other types of
> source code (ruby, bash, procmail, etc)... Maybe I'll just have to use
> Geshi afterall...

If you are looking for code highlighting for all those languages maybe take
a look at
http://www.gnu.org/software/src-highlite/.

> 
> D.Vin

gr,
Thijs

> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux