Welcome Guest, Not a member yet? Register   Sign In
calendar specific date
#1

[eluser]Mutsop[/eluser]
Hi,

I recently came across the following wiki page: [specific date]

Now how is it possible to use this dynamicly?

As in my controller i use this:
Code:
$list = $this->news_model->get_list()->result();

and for each list as item I could use
Code:
$item->date
to get the specific datetime.

But I don't get how to bring these 2 codes together...

Any ideas? Or maybe other work arounds?
#2

[eluser]Mutsop[/eluser]
Anyone able to help me on this? Smile
#3

[eluser]Cristian Gilè[/eluser]
Code:
$list = $this->news_model->get_list()->result();

$cal = array();

foreach($list as $item)
{
  $year = date('Y',$item->date); //I assume that you have stored the news date as int in your db
  $month = date('m',$item->date);
  $day = date('d',$item->date);
  
  $cal[$year][$month][$day] = $item->news_text;
}

$data['calendar'] = $this->calendar->generate('','',$cal); //pass this to your view

Change $item->date and $item->news_text according to your db fields.

Cristian Gilè
#4

[eluser]Mutsop[/eluser]
Well I didn't store the date as int, but I can reformat it and convert to int, no? Big Grin

Thanks thought this is amazing!
#5

[eluser]Cristian Gilè[/eluser]
Yes, you can. I generally prefer to store date as INT because is much easier to work with but this is only my opinion.
There is an open thread about the best way to store the date and time:
http://ellislab.com/forums/viewthread/177759/

Cristian Gilè
#6

[eluser]Mutsop[/eluser]
Well it works like a charm... I do have one last question
In each filled in date, there is a dot that is added to the text

check:
http://www.scripttesting.com/evastienen/..._nationale

For some reason I can't seem to find where to remove the dot.
#7

[eluser]Cristian Gilè[/eluser]
Check the calendar template (if any) for some random dot.

Cristian Gilè
#8

[eluser]Mutsop[/eluser]
Woops forgot my calendar config file Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB