Difference between revisions of "INI SETSECTION()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 1: Line 1:
{{YLM to do}}
+
==Purpose==
 +
Function to set all the key / value pairs of a specified section of an 'ini' file
 +
 
 +
 
 +
==Syntax==
 +
INI_SETSECTION(<object>, <expC1>[, <expC2>])
 +
 
 +
 
 +
==See Also==
 +
[[INI_GET()]], [[INI_GETSECTION()]], [[INI_SET()]]
 +
 
 +
 
 +
==Description==
 +
The INI_SETSECTION() function sets all the key / value pairs of a specified section of an 'ini' file.  The function returns .T. (true) if the values are set successfully, .F. (false) if not.
 +
 
 +
 
 +
{| class="wikitable"
 +
!Parameter||Description
 +
|-
 +
|&#060;object&#062;||Name of the object containing the key / value pairs as properties / values
 +
|-
 +
|<expC1>||Name of the section.
 +
|-
 +
|<expC2>||Name of the ini file.  If this optional parameter it not included, the filename defaults to the recital system configuration file, recital.conf.
 +
|}
 +
 
 +
 
 +
==Example==
 +
<code lang="bash">
 +
# test.ini
 +
# comment lines are preceeded by a '#'
 +
; or a ';'
 +
#
 +
# "Sections" are enclosed in [ and ]
 +
[global]
 +
; key/value pairs are contained in the sections and are written like this
 +
key1 = value
 +
key2 = value2
 +
; You can include macros in the key/value pairs.
 +
key3 = This is $(key2) and $(key1)
 +
# end of test.ini
 +
</code>
 +
<code lang="recital">
 +
obj_global = ini_getsection('global','test.ini')
 +
? obj_global.key3
 +
This is $(key2) and $(key1)
 +
obj_global.key3 = 'value3'
 +
ini_setsection(obj_global,'global','test.ini')
 +
? ini_get('global','key3','','test.ini')
 +
value3
 +
</code>
 +
 
 +
 
 +
==Products==
 +
Recital, Recital Server
 +
 
 +
[[Category:Documentation]]
 +
[[Category:Functions]]
 +
[[Category:INI Files]]
 +
[[Category:INI Files Functions]]

Revision as of 14:11, 3 November 2009

Purpose

Function to set all the key / value pairs of a specified section of an 'ini' file


Syntax

INI_SETSECTION(<object>, <expC1>[, <expC2>])


See Also

INI_GET(), INI_GETSECTION(), INI_SET()


Description

The INI_SETSECTION() function sets all the key / value pairs of a specified section of an 'ini' file. The function returns .T. (true) if the values are set successfully, .F. (false) if not.


Parameter Description
<object> Name of the object containing the key / value pairs as properties / values
<expC1> Name of the section.
<expC2> Name of the ini file. If this optional parameter it not included, the filename defaults to the recital system configuration file, recital.conf.


Example

# test.ini
# comment lines are preceeded by a '#' 
; or a ';'
#
# "Sections" are enclosed in [ and ]
[global]
; key/value pairs are contained in the sections and are written like this
 	key1 = value
 	key2 = value2
; You can include macros in the key/value pairs.
 	key3 = This is $(key2) and $(key1)
# end of test.ini
obj_global = ini_getsection('global','test.ini')
? obj_global.key3
This is $(key2) and $(key1)
obj_global.key3 = 'value3'
ini_setsection(obj_global,'global','test.ini')
? ini_get('global','key3','','test.ini')
value3


Products

Recital, Recital Server