News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Coding a Lorem Ipsum Alternative
August 26, 2013 @ 10:54:02

On the SitePoint PHP blog David Francis has written up an example showing how to create a "lorem ipsum" alternative in PHP. The "lorem ipsum" functionality generates text to put into layouts or prototypes of pages. It's named this way because the first two words are traditionally "lorem ipsum."

Lorem Ipsum generators are well known and are useful for generating text copy during website development. [...] t's good that we have a wide selection of text generators, but how exactly are these generators made? Can we use PHP and MySQL to build our own? That's exactly what we'll tackle in this article. We won't develop a fully working website; what we will cover are the essentials for building a site such as Fillerati.

He suggests using something from Project Gutenberg (a collection of public domain books and other written works) with the HTML markup already included. His personal choice is On the origin of the Species. He uses a simple PHP script to extract the content from the downloaded document to find useable paragraphs (don't want ones that are too long or short). He then takes that same data and populates a few database tables with it and includes the script to extract them and place them in the page. This could easily be adapted into a view helper for your favorite templating language or framework.

0 comments voice your opinion now!
loremipsum alternative projectgutenburg tutorial html extract

Link: http://www.sitepoint.com/coding-a-lorem-ipsum-alternative/

blog comments powered by Disqus

Similar Posts

Design Aeon: Check Dead Links From Database Using PHP CURL

Gonzalo Ayuso's Blog: Real time monitoring PHP applications with websockets and node.js

PHPMaster.com: Understanding Recursion

Syllogistic Software: Learn PHP Tutorial (Video Series)

PHPBuilder.com: Build a PHP Link Scraper with cURL


Community Events





Don't see your event here?
Let us know!


testing threedevsandamaybe framework laravel install refactor developer experience list opinion code podcast community series language interview release introduction unittest wordpress

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework