CodeIgniter Forums
Calender Problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Calender Problem (/showthread.php?tid=14762)



Calender Problem - El Forum - 01-14-2009

[eluser]Solarpitch[/eluser]
Hi,

I have the simplest of code from the calender class below, yet when I call my controller noting will load in my view. I'm stumped.

CONTROLLER:

Code:
function calender_report() {

$this->load->library('calendar');

$data['calender'] = $this->calendar->generate(2009, 1);

}

VIEW:

Code:
<?=$calender_report?>

Then I'm simply calling my controller...

http://mysite.com/index.php/enterprise/calender_report

Am I missing something?


Calender Problem - El Forum - 01-14-2009

[eluser]GSV Sleeper Service[/eluser]
according to that code you should be using
Code:
<?=$calender;?>
in your view


Calender Problem - El Forum - 01-14-2009

[eluser]Solarpitch[/eluser]
No that doesn't make a difference I'm afraid. And using the way I have you don't need a trailing ; after the variable.

Code:
<?=$calender?>
thats the correct way as I know it.

I mean, I basically copied whats in the user guide. It's not a complex example so not sure why its not showing. It's crashing the whole page as the header or footer view isn't loading either.


Calender Problem - El Forum - 01-14-2009

[eluser]Hugh Fletcher[/eluser]
It doesn't appear that your loading your view. Perhaps that's it.


Calender Problem - El Forum - 01-14-2009

[eluser]JoostV[/eluser]
You forgot to load a view file Smile
Code:
$this->load->view('someview', $data['calender']);



Calender Problem - El Forum - 01-14-2009

[eluser]Solarpitch[/eluser]
:red: Ummm ... your right, Let's just pretend this thread never existed!.... It can be our little secret ... sshh! ;-)


Calender Problem - El Forum - 01-14-2009

[eluser]Solarpitch[/eluser]
Actually... now that the stupid part is past us on this thread... is there any way around achieving this:

Below I'm creating a calender for January. I want every day on the calender to be a link so here's what I tried...


Code:
$year = 2009;

//LOOP THROUGH JANUARY AND RETURN EACH DAY IN THE MONTH
$date = mktime(0,0,0,1,1,$year); //The get's the first of Jan 2009
//$links = array();

//ASSIGN EACH DAY TO THE ARRAY AND CREATE A LINK
for($n=1;$n <= date('t',$date);$n++){
$links[$n] = array($n => 'http://www.mysite.ie/enterprise/dashboard/'.$year.'/'.$n.'/1');
}

//PRODUCE THE CALENDERS
$data['calender'][] = $this->calendar->generate($year, 1, $links[1]);

//SEND TO VIEW
$data['right_box'] = "right_box/calender";
$this->load->view('template/page_1', $data);

the problem is creating I get an error for each link which says

Severity: Notice
Message: Array to string conversion

and the link aappears as
http://www.mysite.ie/enterprise/calender/Array