Rémy Salaün a écrit :
Bonjour,
j'utilise ces boucles classiques, qui fonctionnent bien chez mon
hébergeur (1.8 et 1.9):
<BOUCLE_prev(ARTICLES){id_rubrique}{age_relatif>=0}{par num
titre}{inverse}{1,1}>blah-blah html</BOUCLE_prev>
<BOUCLE_next(ARTICLES){id_rubrique}{age_relatif<0}{exclus}{par num
titre}{0,1}>blah-blah html</BOUCLE_next>
Bizarrement, testées sur plusieurs sites chez 1&1, ces mêmes boucles
donnent des résultats erronés. C'est le même code html (même squelette)
et même base Sql 5, même configuration côté espace privé. Tout est
identique.
Je ne comprend pas ce qui cloche !..
Une idée ?..
Merci d'avance 
Rémy
utilise le mode debug, et dis nous quel requet sql sont passés (tu
rajoute &var_mode=debug à la fin de l'URL).
--
Maïeul
http://maieul.ouvaton.org
Merci Maïeul,
voici les résultats (copier/coller du code) relatifs à ces boucles :
// <BOUCLE articles>
0583 //
0584 function BOUCLE_prevhtml_cacdcec900dda37f91a9aadf1f0cd7f1(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {
0585
0586 // REQUETE
0587 $result = spip_optim_select(
0588 array("0+articles.titre AS num",
0589 "articles.id_article",
0590 "articles.titre",
0591 "articles.lang"), # SELECT
0592 array('articles' => 'spip_articles'), # FROM
0593
0594 array(
0595 array('=', 'articles.id_rubrique', spip_abstract_quote($Pile[$SP]['id_rubrique'])),
0596 array('>=', 'LEAST((UNIX_TIMESTAMP("' . normaliser_date($Pile[$SP]['date']) . '")-UNIX_TIMESTAMP(articles.date))/86400,
0597 TO_DAYS("' . normaliser_date($Pile[$SP]['date']) . '")-TO_DAYS(articles.date),
0598 DAYOFMONTH("' . normaliser_date($Pile[$SP]['date']) . '")-DAYOFMONTH(articles.date)+30.4368*(MONTH("' . normaliser_date($Pile[$SP]['date']) . '")-MONTH(articles.date))+365.2422*(YEAR("' . normaliser_date($Pile[$SP]['date']) . '")-YEAR(articles.date)))',
0599 // 1 signes
0600 "'0'"),
0601 array('=', 'articles.statut', '"publie"')), # WHERE
0602 array(), # WHERE pour jointure
0603 '', # GROUP
0604 array('num' . ' DESC'), # ORDER
0605 '1,1', # LIMIT
0606 '', # sous
0607
0608 array(), # HAVING
0609 'articles', # table
0610 '_prev', # boucle
0611 ''); # serveur
0612 $t0 = "";
0613 $SP++;
0614 $old_lang = $GLOBALS['spip_lang'];
0615
0616 // RESULTATS
0617 while ($Pile[$SP] = @spip_abstract_fetch($result,"")) {
0618 if (!$GLOBALS['forcer_lang'])
0619 $GLOBALS['spip_lang'] = ($x = $Pile[$SP]['lang']) ? $x : $old_lang;
0620 $t0 .= (
0621 // 13 signes
0622 '<h2><a href="' .
0623
0624 // #URL_ARTICLE
0625 htmlspecialchars(vider_url(generer_url_article($Pile[$SP]['id_article']))) .
0626
0627 // 9 signes
0628 '" title="' .
0629
0630 // #TITRE
0631 interdire_scripts(supprimer_numero(typo($Pile[$SP]['titre']))) .
0632
0633 // 22 signes
0634 '">Image précédente</a>');
0635 }
0636
0637 $GLOBALS['spip_lang'] = $old_lang;
0638 @spip_abstract_free($result,'');
0639 return $t0;
0640 }
0641
0642
0643 //
0644 // <BOUCLE articles>
0645 //
0646 function BOUCLE_nexthtml_cacdcec900dda37f91a9aadf1f0cd7f1(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {
0647
0648 // REQUETE
0649 $result = spip_optim_select(
0650 array("0+articles.titre AS num",
0651 "articles.id_article",
0652 "articles.titre",
0653 "articles.lang"), # SELECT
0654 array('articles' => 'spip_articles'), # FROM
0655
0656 array(
0657 array('=', 'articles.id_rubrique', spip_abstract_quote($Pile[$SP]['id_rubrique'])),
0658 array('<', 'LEAST((UNIX_TIMESTAMP("' . normaliser_date($Pile[$SP]['date']) . '")-UNIX_TIMESTAMP(articles.date))/86400,
0659 TO_DAYS("' . normaliser_date($Pile[$SP]['date']) . '")-TO_DAYS(articles.date),
0660 DAYOFMONTH("' . normaliser_date($Pile[$SP]['date']) . '")-DAYOFMONTH(articles.date)+30.4368*(MONTH("' . normaliser_date($Pile[$SP]['date']) . '")-MONTH(articles.date))+365.2422*(YEAR("' . normaliser_date($Pile[$SP]['date']) . '")-YEAR(articles.date)))',
0661 // 1 signes
0662 "'0'"),
0663 array('!=', 'articles.id_article', spip_abstract_quote($Pile[$SP]['id_article'])),
0664 array('=', 'articles.statut', '"publie"')), # WHERE
0665 array(), # WHERE pour jointure
0666 '', # GROUP
0667 array('num'), # ORDER
0668 '0,1', # LIMIT
0669 '', # sous
0670
0671 array(), # HAVING
0672 'articles', # table
0673 '_next', # boucle
0674 ''); # serveur
0675 $t0 = "";
0676 $SP++;
0677 $old_lang = $GLOBALS['spip_lang'];
0678
0679 // RESULTATS
0680 while ($Pile[$SP] = @spip_abstract_fetch($result,"")) {
0681 if (!$GLOBALS['forcer_lang'])
0682 $GLOBALS['spip_lang'] = ($x = $Pile[$SP]['lang']) ? $x : $old_lang;
0683 $t0 .= (
0684 // 9 signes
0685 '<a href="' .
0686
0687 // #URL_ARTICLE
0688 htmlspecialchars(vider_url(generer_url_article($Pile[$SP]['id_article']))) .
0689
0690 // 9 signes
0691 '" title="' .
0692
0693 // #TITRE
0694 interdire_scripts(supprimer_numero(typo($Pile[$SP]['titre']))) .
0695
0696 // 25 signes
0697 '">Image suivante</a></h2>');
0698 }
0699
0700 $GLOBALS['spip_lang'] = $old_lang;
0701 @spip_abstract_free($result,'');
0702 return $t0;