Page 1 of 1

List of Events UDT Calendar

Posted: Mon Jun 18, 2012 10:54 am
by zis
Hi,

I used CGCalendar (1.9) or Calendar (0.8.2). I need to create an UDT which prints an output in javascript array form like:

Code: Select all

var events = [
    { Title: "Five K for charity", Date: new Date("06/19/2012"), Link: "/cz/aaa/.25.5.html" },
    { Title: "Dinner", Date: new Date("06/25/2012"), Link: "/cz/bbb/.25.5.html"  }
];
In example are 2 events with event title, date and link. So I need to used (CG)Calender but for output I used jquery datepicker. Datepicker needs an input in form javascript array mentioned above.

Do anyone know how can I create the array from (CG)Calendar events in UDT?

Thanks for ideas,
Regards
John

Re: List of Events UDT Calendar

Posted: Mon Jun 18, 2012 11:33 am
by Zoorlat
Hi,

Not sure I understand what you are doing with the datapicker, but to get the calendar data into a js-array you don't need a UDT. You could do this as a template, with some smarty logic. Then just call that template where you need the js-output in your page.

The only "trick" you need is to encode the curly brackets needed in you javascript with {ldelim}, {rdelim}.

See:
http://www.smarty.net/docsv2/en/languag ... ldelim.tpl

Good luck.

Re: List of Events UDT Calendar

Posted: Mon Jun 18, 2012 2:39 pm
by zis
Thanks for reply,

this js-array is used for events highlighting in datepicker. I am newbie in CMSMS.

Smarty template, you mean in admin Layout->Templates? If you mean it, how can I get access to Calendar data throught Smarty?

Thanks

Re: List of Events UDT Calendar

Posted: Mon Jun 18, 2012 3:06 pm
by Jos
Search for the templates button in the CGCalender admin section