<? 
/** 
 * @desc For example of IniInteraction 
 */ 
 
require_once( dirname(__FILE__).'/class.IniInteraction.php'); 
/* 
    <topic> Example for IniInteraction </topic> 
*/ 
$oIniInteraction = new IniInteraction( TRUE ); 
$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>'; 
*/ 
?>
 
 |