• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calender -> I just can not figure this out

#1
[eluser]visormatt[/eluser]
I can not for the life of me figure out how to create the associative array of data to insert into the calender by way of a normal query. Any suggestions. The CI calender by default expects the array to contain (date -> link) both of which i have in my DB. I am querying and getting the relevant events properly but I am unsure of how to take that result set and output it in the format it expects.

Thank you in advance for any help.

#2
[eluser]danmontgomery[/eluser]
Code:
$data = array();
$query = $this->db->select('date, link')->get('my_table');
foreach($query->result() as $row)
{
  $data[$row->date] = $row->link;
}

echo $this->calendar->generate($year, $month, $data);

#3
[eluser]WebsiteDuck[/eluser]
Something like...
Code:
$this->load->model('events_model');
$this->load->library('calendar');

$events = $this->events_model->getEvents();

foreach ($events as $event) //from your database
{
  $data[ $event['day_number'] ] = $event['url'];
}

echo $this->calendar->generate($year, $month, $data);

If you have nonworking code, you can post it and I'll take a look

#4
[eluser]visormatt[/eluser]
Thank you both very much, working out the details now but the samples you sent over helped GREATLY!!! Thank GOD for the open source community! And once more for good measure, your help is much appreciated Smile

#5
[eluser]changereturnssuccess[/eluser]
[quote author="WebsiteDuck" date="1263270232"]Something like...
Code:
$this->load->model('events_model');
$this->load->library('calendar');

$events = $this->events_model->getEvents();

foreach ($events as $event) //from your database
{
  $data[ $event['day_number'] ] = $event['url'];
}

echo $this->calendar->generate($year, $month, $data);

If you have nonworking code, you can post it and I'll take a look[/quote]

Thank you! =)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.