Re: [SMARTY] help me with Date_Calc and Smarty
| From: | messju mohr | Date: | Fri, 22 Aug 2003 09:09:40 +0000 |
| Subject: | Re: [SMARTY] help me with Date_Calc and Smarty | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10108@lists.php.net to get a copy of this message | ||
On Fri, Aug 22, 2003 at 04:03:20PM +0800, Sn!per wrote:
> [blushed] i should have mentioned that i want to generate the calendar for the whole month of
> august. and yes i have done a print_r($calmon) before. the output looks good.
>
> but what i received is way out of my intention. i refer to the manpages and stumped across
> nested section. BUT the more i read and cross-referenced postings in the archive, just made me more
> confused :)
>
> :)) pls help.
<table border="1" cellpadding="2" cellspacing="0"
width="100%">
{section name=week loop=$days}
<tr>
{section name=dow loop=$days[week]}
<td>{$days[week][dow]|date_format:"%d"}</td>
{/section}
</tr>
{/section}
</table>
if you want to tweak the output (maybe not showing 28,29,30,31 at the
beginning and stuff) i suggest to do that in php before assigning the
value.
> --
>
> Quoting messju mohr <messju@lammfellpuschen.de>:
>
> > On Fri, Aug 22, 2003 at 03:18:52PM +0800, Sn!per wrote:
> > > php script:
> > > <?
> > > require_once "smarty/Smarty.class.php";
> > > require_once "Date/Calc.php";
> > >
> > > $tpl = new Smarty;
> > > $cal = new Date_Calc;
> > >
> > > $calmon = $cal->getCalendarMonth(8,2003);
> > >
> > > $tpl->assign("days",$calmon);
> > > $tpl->display("calmon.tpl");
> > >
> > > ?>
> > >
> > > smarty's template:
> > > <table border="1" cellpadding="2" cellspacing="0"
> > > width="100%">
> > > {section name=num loop=$days}
> > > <tr>
> > > <td>{$days[num][0]}
> > > </td>
> > > </tr>
> > > {/section}
> > > </table>
> > >
> > >
> > > ouput:
> > > 20030728
> > > 20030804
> > > 20030811
> > > 20030818
> > > 20030825
> > >
> > > i am really confused. pls advise. tia
> >
> >
> > in your php do "print_r($calmon);"
> > to examine and understand what $cal->getCalendarMonth() returns.
> >
> > in the template do "{$days[num][0]|date_format}"
> > to convert the canonified "YYYYMMDD"-dates to common human formats.
> >
> >
> > --
> > Smarty General Mailing List (http://smarty.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
>
>
> ---------------------------------------------------
> Sign Up for free Email at http://ureg.home.net.my/
> ---------------------------------------------------
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php