WEB-NES-BAY

Learn Tips and tricks on Linux, Hacking, linux, PHP, Perl, Web, Hardware

bookmark bookmark
Posted by WEBNESBAY 1 COMMENT

If you have an article in your site and Typically you would want to display the 5 to 10 words summary with a “Read More” the full article link as in joomla. The substr function would be an easy solution except that it does not bother about the word boundaries. Here is the code for
<?php
 function word_split($str,$words=15) {
$arr = preg_split(“/[\s]+/”, $str,$words+1);
$arr = array_slice($arr,0,$words);
return join(‘ ‘,$arr);
}
//Usage
$input = ‘This is the test for truncating long string along word boundaries in PHP.
In PHP. PHP [...]

Categories: PHP
Posted by WEBNESBAY 1 COMMENT

PHP allows you to generate PDF files dynamically, which can be useful for a variety of tasks. FPDF is a free PHP class containing a number of functions that let you create and manipulate PDFs.
PDFlib
The PHP API contains a number of functions for handling PDF files designed to be used with the PDFlib. Although extensive, this library is not free for commercial use. A free version called PDFlib Lite is available for personal use, but is limited in functionality. To [...]

Categories: PHP