a good heuristic for OG
authorx2000habouzit <x2000habouzit>
Sat, 13 Nov 2004 11:46:31 +0000 (11:46 +0000)
committerx2000habouzit <x2000habouzit>
Sat, 13 Nov 2004 11:46:31 +0000 (11:46 +0000)
htdocs/advanced_search.php
templates/search.tpl

index beb77cc..e51dbc5 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: advanced_search.php,v 1.27 2004-11-06 17:22:11 x2000habouzit Exp $
+        $Id: advanced_search.php,v 1.28 2004-11-13 11:46:31 x2000habouzit Exp $
  ***************************************************************************/
 
 require("auto.prepend.inc.php");
@@ -145,5 +145,16 @@ else {
     
 }
 
+function display_lines($text) {
+    $n = 0;
+    $i=-1;
+    while(($i=strpos($text,'<tr>',$i+1))!==false) $n++;
+    $i=-1;
+    while(($i=strpos($text,'<div class="nom">',$i+1))!==false) $n++;
+    return $n;
+}
+
+$page->register_modifier('display_lines', 'display_lines');
+
 $page->run();
 ?>
index b95b144..9bdd705 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: search.tpl,v 1.26 2004-11-13 10:52:50 x2000habouzit Exp $
+        $Id: search.tpl,v 1.27 2004-11-13 11:46:31 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
@@ -34,6 +34,7 @@
   </h1>
 
   <div class="contact-list" style="clear:both">
+    {capture name=list}
     {section name=resultat loop=$resultats}
       {if !$resultats[resultat].inscrit || $resultats[resultat].decede}<div class='grayed'>{/if}
         {if $resultats[resultat].contact || $resultats[resultat].watch}
@@ -44,6 +45,8 @@
       {include file=include/minifiche.tpl c=$resultats[resultat] show_action=$show_action inscrit=$resultats[resultat].inscrit}
       {if !$resultats[resultat].inscrit || $resultats[resultat].decede}</div>{/if}
     {/section}
+    {/capture}
+    {$smarty.capture.list|smarty:nodefaults}
   </div>
 
   {if $perpage < $nb_resultats_total}
 
   {min_auth level='cookie'}
   <br />
-  {if $advanced && $smarty.section.resultat.total>10}{include file=search.adv.links.tpl do_title=1}{/if}
+  {if $advanced && $smarty.capture.list|smarty:nodefaults|display_lines > 20}{include file=search.adv.links.tpl do_title=1}{/if}
   
-  <h2>Astuces</h2>
-  
-  <p>Si tu survoles une fiche, tu sauras quand elle a été mise à jour la dernière fois !</p>
+  <p>
+  <strong>Astuce:</strong>
+  Si tu survoles une fiche, tu sauras quand elle a été mise à jour la dernière fois !</p>
   {/min_auth}
 {else}
   {if $advanced}