Witam.
Mam pewną prośbę. Czy ktoś obeznany może zajrzeć do mojego kodu archiwum, opartego na cutenewsie i podpowiedzieć w jaki sposób zmienić go tak, aby pokazywał wiadomości w kolejności czasowej? Chodzi o to, że obecnie pokazuje je pod względem ilości newsów, wygląda to tak:
Październik - 2013 (64)
Listopad - 2013 (60)
Wrzesień - 2013 (14)

Powinno być tak:
Listopad - 2013 (60)
Październik - 2013 (64)
Wrzesień - 2013 (14)

Oto kod archiwum:

  1. <?PHP
  2.  
  3. error_reporting (E_ALL ^ E_NOTICE);
  4.  
  5. $cutepath = __FILE__;
  6. $cutepath = preg_replace( "'\\\show_archives\.php'", "", $cutepath);
  7. $cutepath = preg_replace( "'/show_archives\.php'", "", $cutepath);
  8.  
  9. require_once("$cutepath/inc/functions.inc.php");
  10. require_once("$cutepath/data/config.php");
  11. if(!isset($template) or $template == "" or strtolower($template) == "arch"){ require_once("$cutepath/data/Arch.tpl"); }
  12. else{
  13. if(file_exists("$cutepath/data/${template}.tpl")){ require_once("$cutepath/data/${template}.tpl"); }
  14.  
  15. else{ die("Error!<br>the template <b>".htmlspecialchars($template)."</b> does not exists, note that templates are case sensetive and you must write the name exactly as it is"); }
  16. }
  17.  
  18. // Prepare requested categories
  19. if(eregi("[a-z]", $category)){
  20. die("<b>Error</b>!<br>CuteNews has detected that you use \$category = \"".htmlspecialchars($category)."\"; but you can call the categories only with their <b>ID</b> numbers and not with names<br>
  21. example:<br><blockquote>&lt;?PHP<br>\$category = \"1\";<br>include(\"path/to/show_archives.php\");<br>?&gt;</blockquote>");
  22. }
  23. $category = preg_replace("/ /", "", $category);
  24. $tmp_cats_arr = explode(",", $category);
  25. foreach($tmp_cats_arr as $key=>$value){
  26. if($value != ""){ $requested_cats[$value] = TRUE; }
  27. }
  28.  
  29.  
  30. if($archive == "" or !$archive){
  31. $news_file = "$cutepath/data/news.txt";
  32. $comm_file = "$cutepath/data/comments.txt";
  33. }else{
  34. $news_file = "$cutepath/data/archives/$archive.news.arch";
  35. $comm_file = "$cutepath/data/archives/$archive.comments.arch";
  36. }
  37.  
  38. if($subaction == "" or !isset($subaction)){
  39. $user_query = cute_query_string($QUERY_STRING, array("start_from", "archive", "subaction", "id", "ucat"));
  40.  
  41. if(!$handle = opendir("$cutepath/data/archives")){ die("<center>Can not open directory $cutepath/data/archives "); }
  42. while (false !== ($file = readdir($handle))) {
  43. $file_arr = explode(".",$file);
  44. if($file != "." and $file != ".." and $file_arr[1] == "news"){
  45. $arch_arr[] = $file_arr[0];
  46. }
  47. }
  48. closedir($handle);
  49.  
  50.  
  51.  
  52. function datePl($format,$time=NULL)
  53. {
  54. if($time===NULL)
  55. $time=time();
  56.  
  57. $months=array(
  58. 'Jan'=>'Styczeń',
  59. 'Feb'=>'Luty',
  60. 'Mar'=>'Marzec',
  61. 'Apr'=>'Kwiecień',
  62. 'May'=>'Maj',
  63. 'Jun'=>'Czerwiec',
  64. 'Jul'=>'Lipiec',
  65. 'Aug'=>'Sierpień',
  66. 'Sep'=>'Wrzesień',
  67. 'Oct'=>'Październik',
  68. 'Nov'=>'Listopad',
  69. 'Dec'=>'Grudzień' );
  70.  
  71. $d=date($format,$time);
  72. $keys=array_keys($months);
  73. return str_replace($keys,$months,$d);
  74. }
  75.  
  76.  
  77.  
  78.  
  79. if(is_array($arch_arr)){
  80. $arch_arr = array_reverse($arch_arr);
  81. foreach($arch_arr as $arch_file){
  82.  
  83. $news_lines = file("$cutepath/data/archives/$arch_file.news.arch");
  84. $count = count($news_lines);
  85. $last = $count-1;
  86. $first_news_arr = explode("|", $news_lines[$last]);
  87. $last_news_arr = explode("|", $news_lines[0]);
  88.  
  89. $first_timestamp = $first_news_arr[0];
  90. $last_timestamp = $last_news_arr[0];
  91.  
  92.  
  93. echo"<a href=\"$PHP_SELF?archive=$arch_file&subaction=list-archive&$user_query\">". datePl("M - <b>Y</b>",$last_timestamp)." <i>($count)</i></a><br />
  94. ";
  95. }
  96. }
  97. }
  98. else{
  99.  
  100. if( $CN_HALT != TRUE and $static != TRUE and ($subaction == "showcomments" or $subaction == "showfull" or $subaction == "addcomment") and ((!isset($category) or $category == "") or $requested_cats[$ucat] == TRUE) ){
  101. if($subaction == "addcomment"){ $allow_add_comment = TRUE; $allow_comments = TRUE; }
  102. if($subaction == "showcomments") $allow_comments = TRUE;
  103. if(($subaction == "showcomments" or $allow_comments == TRUE) and $config_show_full_with_comments == "yes") $allow_full_story = TRUE;
  104. if($subaction == "showfull") $allow_full_story = TRUE;
  105. if($subaction == "showfull" and $config_show_comments_with_full == "yes") $allow_comments = TRUE;
  106.  
  107. }
  108. else{
  109. if($config_reverse_active == "yes"){ $reverse = TRUE; }
  110. $allow_active_news = TRUE;
  111. }
  112. require("$cutepath/inc/shows.inc.php");
  113.  
  114. }
  115. unset($template, $requested_cats, $reverse, $in_use, $archive, $archives_arr, $number, $no_prev, $no_next, $i, $showed, $prev, $used_archives);
  116. ?>
  117. <!-- News Powered by CuteNews: http://cutephp.com/ -->


Z góry bardzo, ale to bardzo dziękuję za pomoc

Pozdrawiam

Problem udało mi się zażegnać smile.gif Jak ktoś by potrzebował pomocy, to tutaj jest rozwiązanie: http://cutephp.com/forum/index.php?showtopic=32552

Za kolor przepraszam, ale chciałem, żeby było widoczne, iż problem już nieaktualny wink.gif