Shape 5

Joomla Templates => User Choice - August 2007 - Club => : albigin October 04, 2007, 12:30:14 AM



: Date in header for non-english
: albigin October 04, 2007, 12:30:14 AM
Hi,

   I have userchoice happily running on a Joomla! 1.5.

   But there's an issue: I'm using a non-english language and I can't have the date on the left hand size of the header in my language: it only comes out in english i.e. "October 4, 2007".

So I looked for a workaround and found following: in index.php of the template around line 1000 I changed to:

<div style="float:left; margin-right: 10px;">
<?php $today = date("j m Y"); PRINT "$today";?>
</div>

Pb. is that if I set m to M the month's name comes out in english! I want it in italian (this is the default language of my site). Any suggestion?

Thx


: Re: Date in header for non-english
: mikek October 04, 2007, 07:23:49 AM
This should work for you.

Just delete:

<?php $today = date("j m Y"); PRINT "$today";?>

and replace it with:


<?php

setlocale(LC_TIME, "it_IT");
echo strftime(" %B");

$today = date(" j, Y"); PRINT "$today";

?>


The setlocale(LC_TIME, "it_IT"); tells it Italy as the locale and %B is the format of the month. If you want to play around with any of the formats here's a list of php date options:

http://us3.php.net/manual/en/function.strftime.php

Hope that helps!

Regards,