Re: [SMARTY] calendars and smarty
| From: | pete M | Date: | Thu, 17 Jun 2004 11:13:15 +0000 |
| Subject: | Re: [SMARTY] calendars and smarty | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11469@lists.php.net to get a copy of this message | ||
It is time for a basic Smarty.App
???
pete
Daniel Cummings wrote:
In a coffee induced mind spill... shouldn't it be *really super easy* to use smarty for calendar display or events and data? smarty is a template tool and a calendar is one of the most universal of templates. It should be possible to build a relatively simple set of nested templates: second, hour, day, week, month, year that just exposes the interface to a well-organized library like PEAR::Calendar. Maybe something like this (shows nesting month, week, day) so you could keep the templates separate and attach a data payload to every level of the calendar (allows all-month, all-week, or all-day events): month.tpl ---------- {*assume getData() returns assoc array of arrays *} {assign var=payload value=$event_obj->getData()} {if $payload}{include file=data.tpl payload=$payload}{else}{section name=w loop=$event_obj} {include file=week.tpl event_obj=$event_obj[w]} {/section}{/if} week.tpl ---------- {assign var=payload value=$event_obj->getData()} {if $payload}{include file=data.tpl payload=$payload}{else}{section name=d loop=$event_obj} {include file=day.tpl event_obj=$event_obj[d]} {/section}{/if} day.tpl ---------- {assign var=payload value=$event_obj->getData()} {if $payload}{include file=data.tpl payload=$payload}{else}{section name=h loop=$event_obj} {include file=hour.tpl event_obj=$day[h]} {/section}{/if} etc.... then the actual data display: data.tpl ---------- {section name=data loop=$payload.key}{$payload.key[data]}<br>{/section} is this the most straighforward way one could interface with a database of events for calendar display in smarty? does anyone know of any PHP calendars that use smarty? this framework is just a shot in the dark. I would like to learn the best way to approach this problem. dan On 6/15/04 7:51 PM, "Jochem Maas" <jochem@iamjochem.com> wrote:Sarah Gray wrote:I have played with the smarty plugin below and also with PEAR::Calendar, deciding between the two for usage. They are both nice, but the thing that is special about PEAR is that it allows you to pass an array of selected items (like day objects) when you build your calendar, so that you can take output from a database (for an event calendar, say) and have the calendar draw itself accordingly (days with events a diff color, have a diff behaviour when clicked, etc). I didn't see similar functionality in the smarty calendar plugin. Is there something like this that I missed in the smarty one? And if you wanted thisif you missed it, then so did I! - you can't pass date related data to it for rendering.functionality would you agree that using the PEAR class makes more sense -- or not? thanks,I find PEAR too obtuse most of the time, but the answer is always to use what works best for you. phpclasses.org might also be a place to look. probably nothing works exactly the way you wanted, but you could always roll your own based on the various implementations you have already. btw your welcome to try my extended version of the 'smarty' calendar widget - mail me off list for a link, if you do I would really appreciate any comments you might have (Erich Beyrent if your listening ;-) as as side note - the day-data display functionality is something I still _have_ to add (for the current project I am working on -- I'd rather write it myself and learn something in the process) and your welcome to those changes too when I make them, say within 6 weeks. do you know what form your date related data is in already? e.g. do you use some kind of generic container/object or just raw mysql resultsets etc - your input might help me to decide in what format the calendar widget should accept date related data for displaying in popups (I already use the popup widget plugin so I will integrate that). enough rambling.. if your interested please let me know. Also have another think about what it is your are trying to do. it very easy to get caught up in the features of different lib/classes etc and start to match to solution to the capabilities. for instance: if you wanted to show all entries of a particular month in a calendar from a given (user selected) day onward you could use the simpler smarty calendar as a navigational control while displaying the appropriate list of calendar items in a table. grtz, Jochems. Jochem Maas wrote:what do you want it to do? there is a nice/simple output calendar plugin which you can find in the smarty wiki (of which I have an extended version which allows showing of multiple months and choosing which day is 1st-day-of-week - mail me if you want it or check the archives for the download link, there is an exmaple included) I also use to show a client side calendar: http://dynarch.com/mishoo/calendar.epl Daniel Cummings wrote:IYHO... which calendar lib works nicely with smarty? I'm currently looking at PEAR::Calendar and finding it a little abstract. Is there something moretuned to smarty ken?dan-- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php