I have this code that loads a file .ini:
class Page{
public $lang;
function __construct($lang){
$this->lang = $lang;
$this->page = basename($_SERVER['PHP_SELF'], ".php");
}
public function writeContent($part){
$load_page = parse_ini_file('lang/'.$this->lang.'.content.ini', true);
return $load_page[$this->page][$part];
}
}
This loads a file like "it.content.ini" or "en.content.ini"... The ini file is structured like this:
[page-name-one]
title = "THE TITLE"
caption1 = "Text one"
caption2 = "Text two"
[page-name-two]
title = "THE TITLE OF THE SECOND PAGE"
caption1 = "Text one second page"
caption2 = "Text two second page"
This works perfectly as it loads the file and shows me the section (between square-brackets) based on the page name.
Is it possible to load only a part of the ini file without using multiple files?
When I load index.php I'd like the PHP to actually load the ini file ONLY for the [index] part of the ini file so that if the file is actually big I only load a part of it. Is it possible?