Loading ...
Sorry, an error occurred while loading the content.

Re: Shortest script to create monthly calendar using smarty

Expand Messages
  • Shekar C. Reddy
    Hi, Maybe I missed the answer to this glitch. If you posted a reply/solution to this issue, do let me know. Thanks, ... the ... drawing ... Probably
    Message 1 of 3 , May 7, 2006
    • 0 Attachment
      Hi,

      Maybe I missed the answer to this glitch. If you posted a
      reply/solution to this issue, do let me know.

      Thanks,



      --- In phpexperts@yahoogroups.com, "Shekar C. Reddy"
      <powerobject@...> wrote:
      >
      > Hi,
      >
      > Thanks for the script.
      >
      > However, when I generate the calendar for 4/2006, it is starting
      the
      > 1st of April on Tuesday (number of days: 30). For 3/2006, it is
      > starting the 1st of March on Sunday (number of days: 31) and
      drawing
      > starting on the second row leaving the first row empty. These are
      > the two glitches I found with the script. Something wrong with the
      > offsets?
      >
      >
      >
      > --- In phpexperts@yahoogroups.com, "Hasin Hayder" <phpfive@>
      > wrote:
      > >
      > > Hi
      > > Here is a script to create monthly calendar using smarty.
      Probably
      > its
      > > the shortest one... [icon_biggrin.gif]
      > >
      > > Code: <?
      > > include_once("libs/Smarty.class.php");
      > > $month = 07+1; //calendar for july, 06
      > > $year = 2006;
      > > $total_days = date("t",strtotime("{$month}/0/{$year}"));
      > > $dates = array_fill(1, date("w",
      > > strtotime("{$month}/01/{$year}"))+1,"&");
      > > $week_days = array
      > ( "<b>sun</b>", "<b>mon</b>", "<b>tue</b>",
      > > "<b>wed</b>", "<b>thu</b>","<b>fri</b>", "<b>sat</b>");
      > > $days=array_merge($week_days, $dates);
      > > $days = array_merge($days, range(1, $total_days));
      > > $smarty = new smarty();
      > > $smarty->assign("dates", $days);
      > > $smarty->display("calendar.tpl");
      > > ?>
      > >
      > > calendar.tpl
      > > Code:
      > > {html_table loop=$dates cols=7 table_attr='border="1"
      > cellpadding="5"
      > > cellspacing="1"'}
      > >
      > >
      > > Thanks
      > > Hasin Hayder
      > > http://hasin.wordpress.com <http://hasin.wordpress.com/>
      > > http://packtpub.com/smarty/book <http://packtpub.com/smarty/book>
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.