O'Reilly logo

CodeIgniter 2 Cookbook by Rob Foster

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using word_limiter() for table output

Suppose that you're making a CMS or some sort of admin interface and you're currently making a view which lists—oh I don't know—articles. Suppose that there are some articles in your database and you have to list them. It might be considered useful to the user of the CMS to provide them with a brief preview of the article so that they can be sure that they're deleting, editing, or just looking at the correct one. A preview—similar to the one found in an e-mail client—displays the first few lines, so that a user can be sure of what they're looking at. CodeIgniter comes with a handy function for limiting the number of words displayed from a string of text; this function is perfect for such a purpose. Here, we're ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required