PHP Classes

File: examples/templater/templater.php

Recommend this page to a friend!
  Classes of Christian Vigh   PHP RTF Tools   examples/templater/templater.php   Download  
File: examples/templater/templater.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP RTF Tools
Parse and generate RTF documents using templates
Author: By
Last change: Since the SearchableFileClass source is now included by the Rtf*.phpclass files, examples and documentations have been updated accordingly
Date: 8 years ago
Size: 876 bytes
 

Contents

Class file image Download
<?php
   
/****************************************************************************************************
     *
     * This script demonstrates the Rtf text templating capabilities of the RtfTemplater classes
     * (RtfStringTemplater or RtfFileTemplater).
     *
     * It extract text contents from file "template.rtf", which contains a whole set of templating
     * instructions.
     *
     ****************************************************************************************************/

   
include ( '../../sources/RtfTemplater.phpclass' ) ;

   
$variables =
       [
       
'VNAME1' => 'the value of vname1',
       
'VNAME2' => 'the value of vname2',
       
'INDEX' => 17,
       
'ARRAY' => [ 'string a', 'string b', 'string c' ]
        ] ;

    
$templater = new RtfStringTemplater ( file_get_contents ( 'template.rtf' ), $variables ) ;
    
$templater -> SaveTo ( 'sample.rtf' ) ;