Blockquote
I need some help in cakephp 2.9.
So my query is I have to create date explorer in such a way that
year(2017)
--Month(Jan)
--Month(feb)
--Month(March)
--Month(&so on)
where each Month contains some data which posted in that month.
I have tried some solution But I am Getting
year()2017
--Month(Jan)
year()2017
--Month(Feb)
which is not accurate solution.
Kindly help to solve this problem.
This is my code.
$blog_date is retriving from database which is not a date
$initial = '';
foreach ($blog_date as $date):
$years =
date('Y',strtotime($date['Blog']['publish']));
if ($initial !== $years) {
$initial = $years;
echo $this->Html->tag('li', $this->Html->link($this->Html->tag('i', '', ['class' => 'fa fa-caret-left']).$initial, '/blogs/'/* .$slug.'/'.$key */, ['escape' => false]));
}
endforeach;