Hi all
I'm new on the list.
Do someone know how to write the current date or current year with a spip tag?
Thank you in advance
Best regards from Brazil!
Tereza
Hi all
I'm new on the list.
Do someone know how to write the current date or current year with a spip tag?
Thank you in advance
Best regards from Brazil!
Tereza
2006/11/24, Tereza Loparic <telopa@gmail.com>:
Merci, Gilles
But this will probably return the date as a number or in English, but
I need it in Portuguese. It's a pity because spip already does it
quite right for the articles' dates. So a tag for this would be very
helpful...
hmm. tags in Spip are related to elements manipulated by Spip.
However you can create your own tag to return the current translated date.
It would give something like this :
- create this function in mes_fonctions.php :
function balise_DATE_DU_JOUR($p) {
inclure_spip('inc/util');
$jour["Monday"] = _T('date_jour_2');
$jour["Tuesday"] = _T('date_jour_3');
$jour["Wednesday"] = _T('date_jour_4');
$jour["Thursday"] = _T('date_jour_5') ;
$jour["Friday"] = _T('date_jour_6');
$jour["Saturday"] = _T('date_jour_7');
$jour["Sunday"] = _T('date_jour_1');
$mois["January"] = _T('date_mois_1');
$mois["Febrary"] = _T('date_mois_2');
$mois["March"] = _T('date_mois_3');
$mois["April"] = _T('date_mois_4');
$mois["May"] = _T('date_mois_5');
$mois["June"] = _T('date_mois_6');
$mois["July"] = _T('date_mois_7');
$mois["August"] = _T('date_mois_8');
$mois["September"] = _T('date_mois_9');
$mois["October"] = _T('date_mois_10');
$mois["November"] = _T('date_mois_11');
$mois["December"] = _T('date_mois_12');
$month = Date(F);
$day = Date(l);
$p->code = $jour[$day].' '.$mois[$month].' '.Date(Y);
}
and then you should insert the current date inside your templates with
a simple #DATE_DU_JOUR
Of course it hasn't been tested and may be corrected,
hope it helps,
.Gilles
---
Is it correct? If so, is there a right place to post this kind of
suggestion for further versions?Thank you again
TerezaOn 11/24/06, Gilles Vincent <gilles.vincent@gmail.com> wrote:
> just insert into your template
> <?php echo date('Y'); ?>
>
> (for some help on the date() function : see
> http://http://php.net/date. It's not Spip,just PHP)
>
> You may have some cleaner way to do this, but I'm a bit lazy
>
> .Gilles
> --
> 2006/11/24, Tereza Loparic <telopa@gmail.com>:
> > Hi all
> >
> > I'm new on the list.
> >
> > Do someone know how to write the current date or current year with a spip tag?
> >
> > Thank you in advance
> >
> > Best regards from Brazil!
> >
> > Tereza
> > _______________________________________________
> > spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en
> >
>--
--------------------------
Abelhaweb design
(11) 3726-5577
Hi, Gilles
It looks fine, but still doesn't work.
I don't have any 'mes_fonctions.php' (i'm using 1.9), but as is said at:
i add <?php and ?> put it at /squelettes, but then i get:
Fatal error: Call to undefined function: inclure_spip() in
/home/restricted/home/hipermeios/public_html/spip/squelettes/mes_fonctions.php
on line 4
wich is:
inclure_spip('inc/util');
I try several variations for the path, but doesn't work.
Where's my mistake?
Thank you very much.
Tereza
PS: is there any other messages at this list? Because I don't receive them.
On 11/25/06, Gilles Vincent <gilles.vincent@gmail.com> wrote:
2006/11/24, Tereza Loparic <telopa@gmail.com>:
> Merci, Gilles
>
> But this will probably return the date as a number or in English, but
> I need it in Portuguese. It's a pity because spip already does it
> quite right for the articles' dates. So a tag for this would be very
> helpful...
>hmm. tags in Spip are related to elements manipulated by Spip.
However you can create your own tag to return the current translated date.It would give something like this :
- create this function in mes_fonctions.php :
function balise_DATE_DU_JOUR($p) {
inclure_spip('inc/util');$jour["Monday"] = _T('date_jour_2');
$jour["Tuesday"] = _T('date_jour_3');
$jour["Wednesday"] = _T('date_jour_4');
$jour["Thursday"] = _T('date_jour_5') ;
$jour["Friday"] = _T('date_jour_6');
$jour["Saturday"] = _T('date_jour_7');
$jour["Sunday"] = _T('date_jour_1');$mois["January"] = _T('date_mois_1');
$mois["Febrary"] = _T('date_mois_2');
$mois["March"] = _T('date_mois_3');
$mois["April"] = _T('date_mois_4');
$mois["May"] = _T('date_mois_5');
$mois["June"] = _T('date_mois_6');
$mois["July"] = _T('date_mois_7');
$mois["August"] = _T('date_mois_8');
$mois["September"] = _T('date_mois_9');
$mois["October"] = _T('date_mois_10');
$mois["November"] = _T('date_mois_11');
$mois["December"] = _T('date_mois_12');$month = Date(F);
$day = Date(l);
$p->code = $jour[$day].' '.$mois[$month].' '.Date(Y);
}
and then you should insert the current date inside your templates with
a simple #DATE_DU_JOUROf course it hasn't been tested and may be corrected,
hope it helps,
.Gilles
---
> Is it correct? If so, is there a right place to post this kind of
> suggestion for further versions?
>
> Thank you again
> Tereza
>
> On 11/24/06, Gilles Vincent <gilles.vincent@gmail.com> wrote:
> > just insert into your template
> > <?php echo date('Y'); ?>
> >
> > (for some help on the date() function : see
> > http://http://php.net/date. It's not Spip,just PHP)
> >
> > You may have some cleaner way to do this, but I'm a bit lazy
> >
> > .Gilles
> > --
> > 2006/11/24, Tereza Loparic <telopa@gmail.com>:
> > > Hi all
> > >
> > > I'm new on the list.
> > >
> > > Do someone know how to write the current date or current year with a spip tag?
> > >
> > > Thank you in advance
> > >
> > > Best regards from Brazil!
> > >
> > > Tereza
> > > _______________________________________________
> > > spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en
> > >
> >
>
> --
>
> --------------------------
> Abelhaweb design
> (11) 3726-5577
>
--
--------------------------
Abelhaweb design
(11) 3726-5577
ok, there is something simpler :
James reminded me that #DATE outside a loop gives the desired result.
Use #SET and #GET to store an retreive your result.
For exemple, put at the begining of your template (outside a loop) :
#SET{mydate,#DATE}
and you can use it somewhere else like this
[(#GET{mydate}|affdate)]
.Gilles
----
2006/11/27, Tereza Loparic <telopa@gmail.com>:
Hi, Gilles
It looks fine, but still doesn't work.
I don't have any 'mes_fonctions.php' (i'm using 1.9), but as is said at:
Les variables de personnalisation - SPIPi add <?php and ?> put it at /squelettes, but then i get:
Fatal error: Call to undefined function: inclure_spip() in
/home/restricted/home/hipermeios/public_html/spip/squelettes/mes_fonctions.php
on line 4wich is:
inclure_spip('inc/util');I try several variations for the path, but doesn't work.
Where's my mistake?
Thank you very much.
TerezaPS: is there any other messages at this list? Because I don't receive them.
On 11/25/06, Gilles Vincent <gilles.vincent@gmail.com> wrote:
> 2006/11/24, Tereza Loparic <telopa@gmail.com>:
> > Merci, Gilles
> >
> > But this will probably return the date as a number or in English, but
> > I need it in Portuguese. It's a pity because spip already does it
> > quite right for the articles' dates. So a tag for this would be very
> > helpful...
> >
>
> hmm. tags in Spip are related to elements manipulated by Spip.
> However you can create your own tag to return the current translated date.
>
> It would give something like this :
>
> - create this function in mes_fonctions.php :
>
> function balise_DATE_DU_JOUR($p) {
> inclure_spip('inc/util');
>
> $jour["Monday"] = _T('date_jour_2');
> $jour["Tuesday"] = _T('date_jour_3');
> $jour["Wednesday"] = _T('date_jour_4');
> $jour["Thursday"] = _T('date_jour_5') ;
> $jour["Friday"] = _T('date_jour_6');
> $jour["Saturday"] = _T('date_jour_7');
> $jour["Sunday"] = _T('date_jour_1');
>
> $mois["January"] = _T('date_mois_1');
> $mois["Febrary"] = _T('date_mois_2');
> $mois["March"] = _T('date_mois_3');
> $mois["April"] = _T('date_mois_4');
> $mois["May"] = _T('date_mois_5');
> $mois["June"] = _T('date_mois_6');
> $mois["July"] = _T('date_mois_7');
> $mois["August"] = _T('date_mois_8');
> $mois["September"] = _T('date_mois_9');
> $mois["October"] = _T('date_mois_10');
> $mois["November"] = _T('date_mois_11');
> $mois["December"] = _T('date_mois_12');
>
> $month = Date(F);
>
> $day = Date(l);
>
> $p->code = $jour[$day].' '.$mois[$month].' '.Date(Y);
>
> }
>
> and then you should insert the current date inside your templates with
> a simple #DATE_DU_JOUR
>
> Of course it hasn't been tested and may be corrected,
>
> hope it helps,
>
> .Gilles
> ---
> > Is it correct? If so, is there a right place to post this kind of
> > suggestion for further versions?
> >
> > Thank you again
> > Tereza
> >
> > On 11/24/06, Gilles Vincent <gilles.vincent@gmail.com> wrote:
> > > just insert into your template
> > > <?php echo date('Y'); ?>
> > >
> > > (for some help on the date() function : see
> > > http://http://php.net/date. It's not Spip,just PHP)
> > >
> > > You may have some cleaner way to do this, but I'm a bit lazy
> > >
> > > .Gilles
> > > --
> > > 2006/11/24, Tereza Loparic <telopa@gmail.com>:
> > > > Hi all
> > > >
> > > > I'm new on the list.
> > > >
> > > > Do someone know how to write the current date or current year with a spip tag?
> > > >
> > > > Thank you in advance
> > > >
> > > > Best regards from Brazil!
> > > >
> > > > Tereza
> > > > _______________________________________________
> > > > spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en
> > > >
> > >
> >
> > --
> >
> > --------------------------
> > Abelhaweb design
> > (11) 3726-5577
> >
>--
--------------------------
Abelhaweb design
(11) 3726-5577
Tereza Loparic <telopa@...> writes:
Do someone know how to write the current date or current
year with a spip tag?
Hi Tereza
Why not try something like [(#DATE|affdate)] ?
(#DATE is "now" in SQL format)
You can try variants like [(#DATE|affdate_court)] and so on
-- Fil
Tereza Loparic wrote:
Hi all
I'm new on the list.
Do someone know how to write the current date or current year with a spip tag?
Thank you in advance
Best regards from Brazil!
Hello Tereza,
If you use the SPIP tag #DATE outsite of any loop providing a date (outside articles loops, etc...) then you will get the date of the day (when the cache is computed).
If you need to get this from inside a loop with a date, then you will have to use #ENV{date}.
You can apply on both these tags the date filters as described in the documentation.
Pierre