Zend - The PHP Company




Code Gallery: SHARYANTO


Automatically and evenly split a long HTML text into pages  

Type: class
Added by: SHARYANTO
Entered: 12/12/2000
Last modified: 01/12/2000
Rating: - (fewer than 3 votes)
Views: 8668
The algorithm is quite simple and goes like this: try to split the long text after the desired page length, but delay the split if we are still in <table>'s or <pre>'s or <p>'s in order to avoid screwing up tables (ouch!) or preformatted sections. Guaranteed, this is not perfect, but it works well in most cases. You might want to add the avoidance of breaking <script> sections if you want, etc. For slightly more details, take a look at this page. Enjoy.


dumper +object dump  

Type: code fragment
Added by: SHARYANTO
Entered: 12/07/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 5848
A patched version of Jan Fredrik Leversund's dumper. Dumper, like Perl's Data::Dumper, provides a string representation of a data structure. The string can be eval'ed to recreate the data structure. This version will nicely list object properties instead of just displaying the serialized bytedumps.


valid link! +cache  

Type: code fragment
Added by: SHARYANTO
Entered: 12/07/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 7608
An enhanced form of Idban's valid link!, a PHP script that lets you a test a link for the host's connectivity before displaying it. Enhancements include: cache in session and test for absolute/relative links.

Note that, despite its name, this script does not truely test whether a link is valid. A valid link should return a 200 HTTP status code, which this script does not test. What this script test is whether the web/FTP server of the link is reachable and listening (that is, from server that host the script to the link host, anyway, not from the viewer's computer to the link host :-p). But the script still could be somewhat useful to some of you, I guess.





Search