![]() |
|
Change zenphoto date - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Change zenphoto date (/thread-1782.html) |
Change zenphoto date - Tom - 09-11-2007 Hi, First, thank you very much for this software. Thank you also for the new release!! ` function getSearchDate($format="F Y") { if (in_context(ZP_SEARCH)) {
} return false; } `
` function printAllDates($class="archive", $yearid="year", $monthid="month") { if (!empty($class)){ $class = "class=\"$class\""; } if (!empty($yearid)){ $yearid = "id=\"$yearid\""; } if (!empty($monthid)){ $monthid = "id=\"$monthid\""; } $datecount = getAllDates(); $lastyear = ""; echo "nn"; while (list($key, $val) = each($datecount)) {
} echo "nnn"; } ` In fact, I would like change the months. In example, "January" in "Janvier", "Februar" in "Février", "March" in "Mars. Has someone an idea? Thanks. Sincerely, Change zenphoto date - aitf311 - 09-11-2007 localization is going to be a priority for 1.2, hopefully someone can help you out before then, but if not..it is coming. Change zenphoto date - acrylian - 09-11-2007 Tom: For now I have no other idea than this quick and ugly solution: function printAllDates($class="archive", $yearid="year", $monthid="month") { if (!empty($class)){ $class = "class=\"$class\""; } if (!empty($yearid)){ $yearid = "id=\"$yearid\""; } if (!empty($monthid)){ $monthid = "id=\"$monthid\""; } $datecount = getAllDates(); $lastyear = ""; echo "nn"; while (list($key, $val) = each($datecount)) { $nr++; if ($key == '0000-00-01') { $year = "no date"; $month = ""; } else { $dt = date('Y-F', strtotime($key)); $year = substr($dt, 0, 4); $month = substr($dt, 5); } if ($lastyear != $year) { $lastyear = $year; if($nr != 1) { echo "nn";} echo "$yearnn"; } if($month === "January") { $month = "Janvier"; } // ADD IT LIKE THIS FOR ALL MONTHS echo "[*]$month ($val)n"; } echo "nnn"; }` You shouldn't then edit getSearchDate() but the your search.php around this: ` Change zenphoto date - sbillard - 09-11-2007 Are you calling getSearchDate() directly? If so just add a parameter to the call whith the date format you desire. However, these functions are used to get a 'month year" result for the archive page. If you are getting the English for the month, then the internationalzation of you zenphoto is not setup. If you are looking at different data formats, then you will need to look to a different function. For instance, printImageDate() is the function that would print a date for your image in your theme. These functions also have date format parameters that you can change in your theme to be the format you desire. Change zenphoto date - Tom - 12-11-2007 Hi all! Thanks for your answers!! acrylian : thank you for your code, the first works very well! I have a problem with the second. if(stristr($searchwords,'January')) { $searchwords = strtr($searchwords,'February', 'Fevrier'); } ` See you later. Change zenphoto date - acrylian - 12-11-2007 You're right (although you have a typo in your expample), it's how the strtr() works. Please try this:
The last number in (We had made up a simpler solution for that but that currently doesn't work for me anymore...yesterday it did...) Change zenphoto date - sbillard - 12-11-2007 Another way to do this would be with an array indexed by the English month name:
then take the in printAllDates Change zenphoto date - Tom - 13-11-2007 Thanks acrylian and sbillard: your suggestions work very well! My gallery is now in French (front office only)! See you later and thanks for your help! |