Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Lorem ipsum generation

posted by audvare 8 years ago

Just some random generation of text that would be better looking than using fCryptography::randomString(). Instead of that, or pasting Lorem Ipsum from some random website, perhaps

/**
 * @param int $count Number of words.
 * @return string Random (in order) set of words from Lorem Ipsum text.
 */
fText::loremIpsumWords($count = 1);

/**
 * @param int $count Number of paragraphs to generate.
 * @param bool $html If TRUE, return value is a string of paragraphs wrapped in HTML <p> tags.
 * @return array|string If array, array of paragraphs. If string, a set of paragraphs wrapped in HTML <p> tags.
 */
fText::loremIpsumParagraphs($count = 1, $html = FALSE);

Ideally, these would be random, 2 successive calls to fText::loremIpsumWords() would result in completely different words (first word capitalised on both). Same for fText::loremIpsumParagraphs().

Due to the way I do HTML in my code (generally with code), I'd prefer to receive arrays by default from a function like fText::loremIpsumParagraphs().