[ Dubioza @ 03.01.2012. 13:01 ] @
Pozdrav, forumasi. Srecna Nova!

Kao sto vidite ja novu godinu zapocinjem sa glavoboljom :) Evo o cemu se radi:

Pravim meni za arhivu svih novosti na mom blogu. Kod je sledeci:

Code:

$result = mysql_query("SELECT FROM_UNIXTIME(timestamp, '%M %Y') AS get_month, COUNT(*) AS entries FROM naslovna GROUP BY get_month ORDER BY timestamp DESC"); 

while ($row = mysql_fetch_array($result)) {

    $get_month = $row['get_month'];
    $entries = $row['entries'];
    
    echo "&raquo; <a  href=\"arhiva_novosti.php?month=" . $get_month . "\">" . $get_month . "</a> <strong> (" . $entries . ")</strong><br />";
}


Na sajtu to izgleda ovako:

• December 2011
• November 2011
itd.

E sad, moje pitanje je: Kako da ime meseca, da tako kazem, prevedem na srpski?

Jasno mi je da moram koristiti naredbu:
Code:

date_default_timezone_set('Europe/Belgrade');
setlocale(LC_ALL, 'sr_RS@latin');


Pa sam pokusao sa sledecim kodom ali ne fukcionise:

Code:

$result = mysql_query("SELECT FROM_UNIXTIME(timestamp, '%B %Y') AS get_month, COUNT(*) AS entries FROM naslovna GROUP BY get_month ORDER BY timestamp DESC"); 

while ($row = mysql_fetch_array($result)) {
    $get_month = strftime("%B %Y", $row['get_month']);
    $entries = $row['entries'];


Pokusao sam jos na par nacina ali bezuspesno. Za datum sam koristio timestamp, ne znam...
Pomagajte, jos sam zelen u PHP-u...
[ zmil @ 03.01.2012. 19:29 ] @
$entries = date("m",strtotime($row['entries']));
$maseci=array('','januar','februar'......);
echo "&raquo; <a href=\"arhiva_novosti.php?month=" . $get_month . "\">" . $get_month . "</a> <strong> (" . $maseci[$entries] . ")</strong><br />";