Please, if you would like help editing a .txt
file that is formatted with json_decode()
.
No controller looks like this:
public function index()
{
$json_str = file_get_contents('files/restaurante.txt','r+');
$json_arr = json_decode($json_str);
$this->set('json_arr', $json_arr);
}
A View Line:
<h3><?=$value->{'salada_segunda'}; ?></h3>
It fetches information perfectly. I would like some help to do an editing function of this file via direct input from the browser, so the user does not need to edit directly in the file. Before I saved this data in the database, and my inputs were like this:
<div class="col-sm-6">
<div class="input-group">
<?=
$this->Form->input('salada_segunda',[
'between' => '<span class="input-group-addon"><span class="glyphicon glyphicon-grain"></span></span>',
'type' => 'text',
'class' => 'form-control',
'placeholder' => 'Salada',
'required' => false,
'label' => false,
'div' => false
]);
?>
</div>
</div>
Thanks for the help.