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 QuangLV  >  IniInteraction  >  Example.php  >  Download  
File: Example.php
Role: Example script
Content type: text/plain
Description: Example for IniInteraction
Class: IniInteraction
Create and manipulate .INI configuration files
Author: By
Last change:
Date: 2007-09-18 01:28
Size: 2,136 bytes
 

Contents

Class file image Download
<?
/**
 * @desc For example of IniInteraction
 */

require_once( dirname(__FILE__).'/class.IniInteraction.php');
/*
    <topic> Example for IniInteraction </topic>
*/
$oIniInteraction = new IniInteractionTRUE );
$oIniInteraction->setIniFile(dirname(__FILE__).'/Example.ini');
$oIniInteraction->ParseINI();

# Read Phrases
echo '<b>Read all Phrases:</b> <br>';
print_r$oIniInteraction->getPhrases() );
echo 
'<hr>';

# Read Section
echo '<b>Read one section quanglv:</b> <br>';
print_r$oIniInteraction->getPhrasesSection('quanglv') );
echo 
'<hr>';

# Read Tag
echo '<b>Read one tag quanglv->phone:</b> <br>';
print_r$oIniInteraction->getPhrase('quanglv''phone') );
echo 
'<hr>';

# Insert Section
echo '<b>Insert section thanhnv:</b> <br>';
$oIniInteraction->InsertSection('thanhnv');
$oIniInteraction->InsertPhrase('thanhnv''fullname''Nguyen Viet Thanh');
$oIniInteraction->InsertPhrase('thanhnv''phone''+84 1234567');
$oIniInteraction->InsertPhrase('thanhnv''mobile''+84 7654321');
print_r$oIniInteraction->getPhrases() );
echo 
'<hr>';

# Update Tag Value
echo '<b>Update Tag Value thanhnv->phone:</b> <br>';
$oIniInteraction->UpdatePhraseValue('thanhnv''phone''+84 0000000');
print_r$oIniInteraction->getPhrases() );
echo 
'<hr>';

# Update Tag Name
echo '<b>Update Tag Name thanhnv->mobile:</b> <br>';
$oIniInteraction->UpdatePhrase('thanhnv''mobile''celphone');
print_r$oIniInteraction->getPhrases() );
echo 
'<hr>';

# Update Section Name
echo '<b>Update Section thanhnv:</b> <br>';
$oIniInteraction->UpdateSection('thanhnv''nguyenvietthanh');
print_r$oIniInteraction->getPhrases() );
echo 
'<hr>';

# Remove Tag
echo '<b>Remove tag quanglv->phone:</b> <br>';
$oIniInteraction->RemovePhrase('quanglv''phone');
print_r$oIniInteraction->getPhrases() );
echo 
'<hr>';

# Remove Section
echo '<b>Remove section quanglv:</b> <br>';
$oIniInteraction->RemoveSection('quanglv');
print_r$oIniInteraction->getPhrases() );
echo 
'<hr>';


/*
# UpdateINI
echo '<b>Update INI file:</b> <br>';
$oIniInteraction->UpdateINI();
echo '<b>Result:</b>'; print_r( $oIniInteraction->getPhrases() );
echo '<hr>';
*/
?>