Closed daniel-rodas closed 10 years ago
Hi,
it looks like that, the second "year" in "$year->year" is not defined.
Can you check the $year variable in your view with the following code?
<?php var_dump($year); ?>
...
EDIT:
You can also try this code:
foreach (range(2013, 2020) as $year)
{
$years[] = \Calendar::year($year);
}
$this->template->content_cover = View::forge('calendar/year', array('year' => $years), false);
}
I have replaced: $this->template->content_cover = View::forge('calendar/year', array('year' => $year), false);
with: $this->template->content_cover = View::forge('calendar/year', array('year' => $years), false);
Because $year is only available in the foreach ;) I think this should fix your problem.
Thanks for the quick response, I replaced the foreach code in Mycalendar controller like you recommended but then I get a second error and here is the var_dump($year); and the new error message;
array(8) { [0]=> object(Calendar\Calendar_Cell_Year)#45 (4) { ["_offset":protected]=> int(0) ["_calenadar_name":protected]=> string(7) "default" ["_params":protected]=> array(2) { ["year"]=> int(2013) ["time"]=> int(1357027200) } ["_data":protected]=> NULL } [1]=> object(Calendar\Calendar_Cell_Year)#46 (4) { ["_offset":protected]=> int(0) ["_calenadar_name":protected]=> string(7) "default" ["_params":protected]=> array(2) { ["year"]=> int(2014) ["time"]=> int(1388563200) } ["_data":protected]=> NULL } [2]=> object(Calendar\Calendar_Cell_Year)#47 (4) { ["_offset":protected]=> int(0) ["_calenadar_name":protected]=> string(7) "default" ["_params":protected]=> array(2) { ["year"]=> int(2015) ["time"]=> int(1420099200) } ["_data":protected]=> NULL } [3]=> object(Calendar\Calendar_Cell_Year)#48 (4) { ["_offset":protected]=> int(0) ["_calenadar_name":protected]=> string(7) "default" ["_params":protected]=> array(2) { ["year"]=> int(2016) ["time"]=> int(1451635200) } ["_data":protected]=> NULL } [4]=> object(Calendar\Calendar_Cell_Year)#49 (4) { ["_offset":protected]=> int(0) ["_calenadar_name":protected]=> string(7) "default" ["_params":protected]=> array(2) { ["year"]=> int(2017) ["time"]=> int(1483257600) } ["_data":protected]=> NULL } [5]=> object(Calendar\Calendar_Cell_Year)#50 (4) { ["_offset":protected]=> int(0) ["_calenadar_name":protected]=> string(7) "default" ["_params":protected]=> array(2) { ["year"]=> int(2018) ["time"]=> int(1514793600) } ["_data":protected]=> NULL } [6]=> object(Calendar\Calendar_Cell_Year)#51 (4) { ["_offset":protected]=> int(0) ["_calenadar_name":protected]=> string(7) "default" ["_params":protected]=> array(2) { ["year"]=> int(2019) ["time"]=> int(1546329600) } ["_data":protected]=> NULL } [7]=> object(Calendar\Calendar_Cell_Year)#52 (4) { ["_offset":protected]=> int(0) ["_calenadar_name":protected]=> string(7) "default" ["_params":protected]=> array(2) { ["year"]=> int(2020) ["time"]=> int(1577865600) } ["_data":protected]=> NULL } }
Notice! Fuel\Core\PhpErrorException [ Notice ]: Trying to get property of non-object
PKGPATH/calendar/views/calendar/year.php @ line 2
0 1<?php // echo '
'; var_dump($year); die; ?> 2<?php echo $year->year; ?>
3<?php foreach ($year->get_months() as $month): ?> 4<?php echo $month->month ?>
5
Can you help me setup this calendar please, here is my app controller and my error.
<?php /**
ControllerMycalendar / class Controller_Mycalendar extends Controller_Base { public function action_index() { $this->template->title = "Calendar"; $this->template->contentnode = "*** THIS IS SOME CONTENT NODE YO ***";
}
/*** Error **/
Notice! Fuel\Core\PhpErrorException [ Notice ]: Undefined variable: year
PKGPATH/calendar/views/calendar/year.php @ line 1
0 1
<?php echo $year->year; ?>
2<?php foreach ($year->get_months() as $month): ?> 3 <?php echo $month->month ?>
4 5 <?php foreach ($month->get_weeks() as $week): ?> 6 Backtrace COREPATH/bootstrap.php @ line 98 PKGPATH/calendar/views/calendar/year.php @ line 1 COREPATH/classes/view.php @ line 240 COREPATH/classes/view.php @ line 254 COREPATH/classes/view.php @ line 565 COREPATH/classes/view.php @ line 207 APPPATH/views/layouts/manmadesteak.php @ line 18 COREPATH/classes/view.php @ line 240 COREPATH/classes/view.php @ line 254 COREPATH/classes/view.php @ line 565 COREPATH/classes/view.php @ line 207 DOCROOT/index.php @ line 78