Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Artur Barseghyan  >  Lipsum  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Examples of usage
Class: Lipsum
Generate random text content using Lipsum API
Author: By
Last change: Some minor changes (for better understanding).
Date: 5 years ago
Size: 1,288 bytes
 

Contents

Class file image Download
<?php
/*
 * Copy your Lipsum.php class to directory from which your classes are loaded
 * from. Otherwise, copy it to the directory where your template file is and
 * uncomment the following line.
 */
//include 'Lipsum.php';

// Simple way to do so
echo Lipsum::Generate(5'paragraphs'falsefalse) . PHP_EOL PHP_EOL;

// We can as well make a class and use full advantages of it.
$lipsum = new Lipsum(5'lists'falsetrue);

echo 
$lipsum->render() . PHP_EOL PHP_EOL;

$lipsum->setAmount(3);

echo 
$lipsum->render() . PHP_EOL PHP_EOL;
echo 
$lipsum->render() . PHP_EOL PHP_EOL;

$lipsum->setTags(false);

echo 
$lipsum->render() . PHP_EOL PHP_EOL;
echo 
$lipsum->render() . PHP_EOL PHP_EOL;

$lipsum->setWhat('paragraphs');

echo 
$lipsum->render() . PHP_EOL PHP_EOL;

$lipsum->setTags(true);

echo 
$lipsum->render() . PHP_EOL PHP_EOL;

$lipsum->setAmount(10);
$lipsum->setWhat('words');

echo 
$lipsum->render() . PHP_EOL PHP_EOL;
echo 
$lipsum->render() . PHP_EOL PHP_EOL;
echo 
$lipsum->render() . PHP_EOL PHP_EOL;

// Now we can generate lipsums from cache.
echo $lipsum->random('paragraphs') . PHP_EOL PHP_EOL;
echo 
$lipsum->random('lists') . PHP_EOL PHP_EOL;
echo 
$lipsum->random('words') . PHP_EOL PHP_EOL;
?>