PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Steve Marks   Labels   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Sample Use
Class: Labels
Output address labels in HTML, Word or PDF formats
Author: By
Last change:
Date: 13 years ago
Size: 1,505 bytes


Class file image Download


// Load the library
$labels = new Labels;

// Specify the format
$config['format'] = 'html';
// Specify the address layout, using HTML <br /> tags to determine line breaks
    // The elements listed here become the address array keys (see below)
$config['layout'] = "first_name last_name<br />address_1<br />address_2<br />town<br />county<br />postcode";

// List the addresses to used on the labels
    // Notice how the array keys correpond to the 'layout' element above
$addresses = array(
'address_1'=>'22 Sweet Avenue',
'address_2'=>'Mardi Tres',
'postcode'=>'NY6 6TR'
'address_1'=>'132 Reggae Lane',
'address_2'=>'East Hunting',
'postcode'=>'NN2 5TR'
'address_1'=>'23 Leapord Road',
'postcode'=>'CB4 7YT'

// Output the labels