PHP Classes

Flex Lorem: Generate bogus content to test page layouts

Recommend this page to a friend!
  Info   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2012-08-18 (3 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 253 All time: 7,322 This week: 860Up
Version License PHP version Categories
flex-lorem 0.1GNU General Publi...5HTML, PHP 5, Text processing
Description Author

This class can generate bogus content to test page layouts.

It takes an HTML template and replaces marked sections it with bogus content, tipically with Latin text with words like lorem, ipsum, etc..

The class supports some pre-defined template elements that allow determining the way the template text should be replaced, like text, paragraphs, headlines, images, etc..

Additional plugin classes can be used to customize the way the text is generated.

Innovation Award
PHP Programming Innovation award nominee
August 2012
Number 6

Prize: One copy of VS.PHP
One common way to test page layouts is to fill the content areas with random content.

Often Latin text is used fill in layout spaces so you can see how it looks.

This class can generate random Latin text and fill marked templates with the generated text that will be used to preview the layout to be tested.

Manuel Lemos
Picture of Tom Schaefer
  Performance   Level  
Name: Tom Schaefer is available for providing paid consulting. Contact Tom Schaefer .
Classes: 39 packages by
Country: Germany Germany
Age: ???
All time rank: 1099 in Germany Germany
Week rank: 214 Down7 in Germany Germany Up
Innovation award
Innovation award
Nominee: 9x

Winner: 1x


Class Lorem generates html elements containing lorem ipsum snippets.
It has an easy to use plugin interface. So you can write your own sets of snippets.
Class Lorem comes along with an element builder class which is able to create every 
html element and element attribute you need. The element builder is able to setup well-formed
html. It is fully object-oriented.

Class Lorem has a build-in lorem plugin creator, which converts html source intto a lorem plugin class. Look at the example script how it works.
Once you created a plugin, it will automatically recognized and loaded by class Lorem.

e.g. echo lorem::element("div")
	->addAttribute("class", "article");

  <div class="article">

For a quick impression look at the test script. It shows how to handle {lorem.placeholders} 
with html source snippets.

If you want to see it in action I provided an online show case at
Within the site's form you can manipulate css styles and html elements. You can change the values of the 
layout section. Once you click the loremify button you immediately will see the output results at the bottom of the
web page.

e.g. echo lorem::layout('{Lorem.teaser}')


## provided placeholders

## customization examples
Most of the placeholders are customizable. You can change the output result by adding commaseparated values.

e.g. {Lorem.image, 100, 90} => 90px height image (100 always means 100%)

{Lorem.teaser, 1}
{Lorem.teaser, 2}    => different teaser types
{Lorem.teaser, 3}

{Lorem.headline, 1} > h1
{Lorem.headline, 2} > h2
{Lorem.headline, 3} > h3
{Lorem.headline, 4} > h4

{Lorem.para, 1} > p with only a single word
{Lorem.para, 100} > p with 100 words

## creating a plugin

The first parameter of lorem::createPlugin has to be unique plugin name.
When you define a new placeholder you have to choose a unique name for it.
Otherwise the creator will throw an exception.
The placeholder consists of to parts:
- Lorem (Namespace)
- Placeholder (Method)
e.g. Lorem.choco

The second parameter  of lorem::createPlugin expects an array of the form:
array("name" => array("parameter" => array(), "source" => "your html source");

echo lorem::createPlugin("test", array(
	"sugar" => array(
		"parameters" => array(),
		"source" => '<div class="test">
	"choco" => array(
		"parameters" => array(),
		"source" => '<div class="test">

I hope you see how easy lorem can be used.

Best regards
Tom Schaefer

  Files folder image Files  
File Role Description
Files folder imageplugins (2 files)
Plain text file element.php Class html element creator used by lorem and its plugins
Plain text file lorem.php Class main class
Accessible without login Plain text file readme.txt Doc. read me
Accessible without login Plain text file test.php Example test script and showcase
Accessible without login Plain text file testplugin.php Example example for plugin creator

  Files folder image Files  /  plugins  
File Role Description
  Plain text file image.php Class image plugin
  Plain text file text.php Class text plugin

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:7,322
This week:860Up