-1
Guys if possible would like a help to edit a file .txt
that is formatted with json_decode()
.
On the controller went 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>
He searches for the information perfectly. I would like a help to make 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 was saving that data in the bank, 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>
I appreciate the help.