phps line numbering

php.internals

Kevin Waterson

20 years ago
Addition of line numbering to phps This is a rather simple addition and will be benificial to all who use phps for debugging and/or displaying code. Its a simple diff to zend_highlight.c Patches have been written and languish simply awaiting inclusion in HEAD Can we have a show of hands of those who would like this? 5.1 patch can be viewed here: http://svn.schlueters.de/phpatches/PHP_5_1/zend_highlight_ol.diff Any real reason this cannot be included? Kind regards kevin
-- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote."

Ilia A.

20 years ago
I'd consider it for PHP6, but not for PHP5.1 at least not at this time. Ilia Kevin Waterson wrote:

Johannes Schlueter

20 years ago
Hi Ilia et al., the patch is older than PHP 6 and back then there was nobody interested in committing it so it wasn't brought to HEAD, yet. But I'll do that if the patch itself is being accepted. johannes On Wednesday 15 March 2006 15:46, Ilia Alshanetsky wrote:

Pierre Joye

20 years ago
On 3/15/06, Ilia Alshanetsky <ilia@prohost.org> wrote:
> I'd consider it for PHP6, but not for PHP5.1 at least not at this time.
I'm definitively for having it in php6. For 5.x, if there is a 5.2, then it could be in too. --Pierre

Lukas Smith

20 years ago
Ilia Alshanetsky wrote:
> I'd consider it for PHP6, but not for PHP5.1 at least not at this time.
what exactly is the big deal with adding a new optional parameter? i dont really see the huge impact that should push this feature back to the next major php version. its something that could go into any minor version. regards, Lukas

Lukas Smith

20 years ago
Lukas Smith wrote:
> Ilia Alshanetsky wrote: >> I'd consider it for PHP6, but not for PHP5.1 at least not at this time. > > what exactly is the big deal with adding a new optional parameter? > i dont really see the huge impact that should push this feature back to > the next major php version. its something that could go into any minor > version.
maybe i should clarify that i am only concered about the highlight_file(9 and highlight_string() functions. i dont even think we should add linenumbers to .phps. regards, Lukas

Florian Anderiasch

20 years ago
Kevin Waterson schrieb:
> Addition of line numbering to phps > This is a rather simple addition and will be benificial to all who use phps > for debugging and/or displaying code. Its a simple diff to zend_highlight.c
Hello Kevin, I haven't tested this - but if phps output is numbered, it will be completely cluttered and you can't copy-paste anymore. Exactly when *displaying* code so that people can adapt it that's a quite bad idea then imho. Rather add another extension and leave .phps like it is. Greetings, Florian

Florian Anderiasch

20 years ago
arg, I'm wrong - ignore me please

Aizat Faiz

20 years ago
How about including the patch, and having a php.ini option to enable/disable the line numbering. Kevin Waterson wrote:
> Addition of line numbering to phps > This is a rather simple addition and will be benificial to all who use phps > for debugging and/or displaying code. Its a simple diff to zend_highlight.c > > Patches have been written and languish simply awaiting inclusion in HEAD > > Can we have a show of hands of those who would like this? > 5.1 patch can be viewed here: > http://svn.schlueters.de/phpatches/PHP_5_1/zend_highlight_ol.diff > > Any real reason this cannot be included? > > Kind regards > kevin >
-- aizat faiz: sleep to the power of z. -_-;;^zzz strange symphonies - http://aizatto.com/

Derick Rethans

20 years ago
On Wed, 15 Mar 2006, Aizat Faiz wrote:
> How about including the patch, and having a php.ini option to enable/disable > the line numbering.
NO more ini settings please... and definitely not for something trivial as this. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Kevin Waterson

20 years ago
This one time, at band camp, Aizat Faiz <aizat.faiz@gmail.com> wrote:
> How about including the patch, and having a php.ini option to > enable/disable the line numbering.
I dont think this is a good option, perhaps some other trigger file.phps?numbers or something Kevin
-- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote."

Matthew Charles Kavanagh

20 years ago
That other time, at band camp, Kevin Waterson wrote:
> This one time, at band camp, Aizat Faiz <aizat.faiz@gmail.com> wrote: >> How about including the patch, and having a php.ini option to >> enable/disable the line numbering. > > I dont think this is a good option, perhaps some other trigger > file.phps?numbers or something
But there'd better be an ini option to disable that, and an ini option to control whether line numbering starts at zero or one, and an ini option to disable the ini options. Everyone loves ini options :)

Sean Coates

20 years ago
> Patches have been written and languish simply awaiting inclusion in HEAD
Johannes' method (<ol><li>...</li>...</ol>) doesn't copy & paste well in FireFox 1.5 -- you might consider this a FF problem, but in any case, line numbers are pasted, so this is really a pain for sharing code. Until a good method is found (if there is one), I say leave the patch out -- although, FWIW, I _would_ like to see line numbers if there's a way to make it work well (avoid horizontal scrolling, paste without numbers). S

Jared Williams

20 years ago
> > Patches have been written and languish simply awaiting inclusion in > > HEAD > > Johannes' method (<ol><li>...</li>...</ol>) doesn't copy & > paste well in FireFox 1.5 -- you might consider this a FF > problem, but in any case, line numbers are pasted, so this is > really a pain for sharing code. > > Until a good method is found (if there is one), I say leave > the patch out -- although, FWIW, I _would_ like to see line > numbers if there's a way to make it work well (avoid > horizontal scrolling, paste without numbers).
Pretty sure this isn't possible in Firefox, both avoiding horizontal scrolling and paste without numbers, are mutually exclusive. Replacing the list, with divs and using css generated content to display the line numbers, cleans up the paste output but won't get the word wrap. Jared

Markus Fischer

20 years ago
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Jared Williams wrote:
> Replacing the list, with divs and using css generated content to display the line numbers, cleans up the paste output but won't get
... and doesn't work in IE. So no real win here. The semantic solution would be to use ol/li . regards -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEGRCJ1nS0RcInK9ARAs2NAJ9f+dSTUcQOP4Dv8A5PfOauKVogDgCfSTsw TaMDPYjqDbw9NfGxusCupqI= =o3F+ -----END PGP SIGNATURE-----

Jared Williams

20 years ago
> > Jared Williams wrote: > > Replacing the list, with divs and using css generated content to > > display the line numbers, cleans up the paste output but won't get > > ... and doesn't work in IE. So no real win here. The semantic > solution would be to use ol/li .
Can't use ol/li thou, as that is what messes up the cut & paste in FF. Even if you use conditional CSS, set the list-style to none, and use css generated content to inject the line numbers, when it cut & pastes, FF forgets the list-style none, and still includes junk. Jared

Alan Knowles

20 years ago
Not sure if it's a prefect solution, but this could easily be done: <script type="text/javascript"> function hideNumbers() { var lists = document.getElementsByTagName('ol'); for (var i =0;i<lists.length;i++) { if (!lists[i].getAttribute('isphplist')) { continue; } var lis = lists[i].getElementsByTagName('li'); for (var j =0;j<lis.length;i++) { var ns = document.createElement('div'); ns.innerHTML = lis[j].innerHTML; lis[j].parentNode.replaceChild(ns, lis[j]); } var ns = document.createElement('div'); ns.innerHTML = lists[i].innerHTML ; lists[i].parentNode.replaceChild(ns, lists[i]); } } </script> Jared Williams wrote:

Robert Deaton

20 years ago
Sorry, I meant to send my first mail to the entire list about this, but http://pastebin.com works fine here in firefox, although Jared Williams reported back that it pastes the line numbers for him. Version and OS differences perhaps? I don't have a machine to test IE6, so I'm not sure about that, but Firefox is possible at least. -- --Robert Deaton

Jared Williams

20 years ago
> Sorry, I meant to send my first mail to the entire list about > this, but http://pastebin.com works fine here in firefox, > although Jared Williams reported back that it pastes the line > numbers for him. > Version and OS differences perhaps? I don't have a machine to > test IE6, so I'm not sure about that, but Firefox is possible > at least.
Firefox 1.5.0.1 on Win2K is copying line numbers if select the whole of the source, or if just select a few lines, hashes (#) appear instead. Jared

Kevin Waterson

20 years ago
This one time, at band camp, Alan Knowles <alan@akbkhome.com> wrote:
> Not sure if it's a prefect solution, but this could easily be done:
--8< --- snip I dont see why line numbering is an issue. If you want to highlight code ala pastebin style, simpley echo hightlight_string($string, 1); or if it is a file highlight_file(); This leaves line numbering in phps and I guess a switch using GET could be added, but essentially phps is an excellent tool for debugging. Kind regards Kevin
-- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote."