Alphanav aide nécessaire

  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Inscription: Jan 06, 2006
  • Messages: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Message Décembre 31st, 2012, 6:27 pm

Salut tout le monde et bonne année !

J'ai un code de php de travail qui affiche un indice de navigation alphabétique de A à z dans le haut de mon site Web, sa conception prévue doit ouvrir dans une nouvelle fenêtre, mais maintenant je veux l'ouvrir dans la même page...j'ai trouvé un iframe ou « switch » fonctionnerait très bien, mais je n'arrive pas à le faire fonctionner à droite.

Voici ce que je veux dire, une url pour afficher la question :http://reunitemysite.com/test2/login.php

Lorsque vous cliquez sur un des liens dans le haut alphanav, les affichages de lien css ainsi que la requête mysql entraînerait l'iframe ciblée, je tiens à afficher dans l'iframe est le résultat de la requête mySQL, pas le css de bar alphanav lui-même.

index.php
Code: [ Select ]
<html>
<head> <title> </title>
<meta name="viewport" content="initial-scale=1.0">

<link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />

</head>

<body>

<?php include('az.php'); ?>

<div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>

<div id="login">Login:&nbsp;<input type="username" class="login" size="20px;">
<br />
Password:&nbsp;<input class="login" type="password" size="20px">
<br />
Remember Me? <input type="checkbox">

<a href="#">Register Now For Free!</a>

<div class="note orange rounded">Start your Advertising or Publishing Campaign Now by simply clicking the Register Now button above!</div></div>

<?php


if($GET['frame'] == 1) {

//This creates the menu at the top A-Z 
  $char = $_GET['letter']; 
  $list="num"; 
  foreach (range('A', 'Z') as $i) $list.=",$i"; 
  $list.=",Show All Ads"; 
  $a = explode(',', $list); 
  foreach ($a as $b) { 
    if (!empty($b)) { 
      if ($b=="num") { 
        if ($char=="num") echo "<a href=\"az.php?letter=num\" target=\"target\" >#</a>"; 
        else echo "<a href=\"az.php?letter=num\" target=\"target\">#</a>"; 
      } 
      elseif ($b=="Show All Ads") { 
        if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\" target=\"target\">Show All Ads</a>"; 
        else echo "<a href=\"az.php?letter=*\" target=\"target\">Show All Ads</a>"; 
      } 
      elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\" target=\"target\">$b</a>"; 
      else echo "<a href=\"az.php?letter=".$b."\" target=\"target\">$b</a>"; 
    } 
  }

}

?>

<iframe name="frame">Sorry, you need the newest browser to display iframes!</iframe>

</body>
</html>
  1. <html>
  2. <head> <title> </title>
  3. <meta name="viewport" content="initial-scale=1.0">
  4. <link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
  5. <link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
  6. <link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
  7. </head>
  8. <body>
  9. <?php include('az.php'); ?>
  10. <div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
  11. <div id="login">Login:&nbsp;<input type="username" class="login" size="20px;">
  12. <br />
  13. Password:&nbsp;<input class="login" type="password" size="20px">
  14. <br />
  15. Remember Me? <input type="checkbox">
  16. <a href="#">Register Now For Free!</a>
  17. <div class="note orange rounded">Start your Advertising or Publishing Campaign Now by simply clicking the Register Now button above!</div></div>
  18. <?php
  19. if($GET['frame'] == 1) {
  20. //This creates the menu at the top A-Z 
  21.   $char = $_GET['letter']; 
  22.   $list="num"; 
  23.   foreach (range('A', 'Z') as $i) $list.=",$i"; 
  24.   $list.=",Show All Ads"; 
  25.   $a = explode(',', $list); 
  26.   foreach ($a as $b) { 
  27.     if (!empty($b)) { 
  28.       if ($b=="num") { 
  29.         if ($char=="num") echo "<a href=\"az.php?letter=num\" target=\"target\" >#</a>"; 
  30.         else echo "<a href=\"az.php?letter=num\" target=\"target\">#</a>"; 
  31.       } 
  32.       elseif ($b=="Show All Ads") { 
  33.         if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\" target=\"target\">Show All Ads</a>"; 
  34.         else echo "<a href=\"az.php?letter=*\" target=\"target\">Show All Ads</a>"; 
  35.       } 
  36.       elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\" target=\"target\">$b</a>"; 
  37.       else echo "<a href=\"az.php?letter=".$b."\" target=\"target\">$b</a>"; 
  38.     } 
  39.   }
  40. }
  41. ?>
  42. <iframe name="frame">Sorry, you need the newest browser to display iframes!</iframe>
  43. </body>
  44. </html>


Code: [ Select ]
<?php
 
  // How many adjacent pages should be shown on each side? 
  $adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list) 

  //how many items to show per page 
  $limit = 10; 

  //Number of ads per row
  $rows = 3;
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> 

<title>A To Z AD Navigation </title> 

<style media="screen" type="text/css"> 

html, body { }

#aznavbar a:link { 
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px; 
text-decoration:none; 

 
#aznavbar a:visited { 
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px; 
text-decoration:none; 



#aznavbar a:hover {
background-color: #FA6405;
color:#000; 
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px; 
text-decoration:none; 



#aznavbar a:active{ 
color:#FA6405; 
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px; 
text-decoration:none; 
}

#aznavbar { 
 background: #141414;
 background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
 background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
 background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
 background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
 background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
 background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
 filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
 border: 1px solid #000; 
 margin: -10px 0px 0px -8px;
 padding: 10 0px 10px 80px;
 width: 94.8%;
 } 

a:hover#showall { 


#ad-wrapper{ 
  margin:0px auto 0px auto; 
  text-align:center; 
}

</style> 
</head> 

<body> 


<div id="aznavbar" class="drop-shadow raised">


<?php 
  //This creates the menu at the top A-Z 
  $char = $_GET['letter']; 
  $list="num"; 
  foreach (range('A', 'Z') as $i) $list.=",$i"; 
  $list.=",Show All Ads"; 
  $a = explode(',', $list); 
  foreach ($a as $b) { 
    if (!empty($b)) { 
      if ($b=="num") { 
        if ($char=="num") echo "<a href=\"az.php?letter=num\" target=\"frame\">#</a>"; 
        else echo "<a href=\"az.php?letter=num\" target=\"frame\">#</a>"; 
      } 
      elseif ($b=="Show All Ads") { 
        if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\" target=\"frame\">Show All Ads</a>"; 
        else echo "<a href=\"az.php?letter=*\" target=\"frame\">Show All Ads</a>"; 
      } 
      elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\" target=\"frame\">$b</a>"; 
      else echo "<a href=\"az.php?letter=".$b."\" target=\"frame\">$b</a>"; 
    } 
  } 
?> 
</div>

<?php 
if(!empty($char)){
  include('connect.php'); 
  $tbl_name="amp_ads";    //your table name 
   
  /* 
    First get total number of rows in data table. 
    If you have a WHERE clause in your query, make sure you mirror it here. 
  */ 
  if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name"; 
  elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'"; 
  else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'"; 
  $total_pages = mysql_fetch_array(mysql_query($query)); 
  $total_pages = $total_pages[num]; 
   
  /* Setup vars for query. */ 
  if(!empty($char)) $targetpage = "az.php?letter=$char&"; 
  else $targetpage = "az.php?";   //your file name (the name of this file) 
  $page = $_GET['page']; 
  if($page) 
    $start = ($page - 1) * $limit;       //first item to display on this page 
  else 
    $start = 0;                //if no page var is given, set start to 0 
   
  /* Get data. */ 
  if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit"; 
  elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit"; 
  else $sql = "SELECT * FROM $tbl_name WHERE title LIKE '$char%' LIMIT $start, $limit"; 
  $result = mysql_query($sql); 
   
  /* Setup page vars for display. */ 
  if ($page == 0) $page = 1;          //if no page var is given, default to 1. 
  $prev = $page - 1;              //previous page is page - 1 
  $next = $page + 1;              //next page is page + 1 
  $lastpage = ceil($total_pages/$limit);    //lastpage is = total pages / items per page, rounded up. 
  $lpm1 = $lastpage - 1;            //last page minus 1 
   
  /* 
    Now we apply our rules and draw the pagination object. 
    We're actually saving the code to a variable in case we want to draw it more than once. 
  */ 
  $pagination = ""; 
  if($lastpage > 1) 
  {   
    $pagination .= "<div class=\"pagination\">"; 
    //previous button 
    if ($page > 1) 
      $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>"; 
    else 
      $pagination.= "<span class=\"disabled\">« previous </span>";   
     
    //pages   
    if ($lastpage < 7 + ($adjacents * 2))  //not enough pages to bother breaking it up 
    {   
      for ($counter = 1; $counter <= $lastpage; $counter++) 
      { 
        if ($counter == $page) 
          $pagination.= "<span class=\"current\">$counter</span>"; 
        else 
          $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
      } 
    } 
    elseif($lastpage > 5 + ($adjacents * 2))  //enough pages to hide some 
    { 
      //close to beginning; only hide later pages 
      if($page < 1 + ($adjacents * 2))     
      { 
        for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) 
        { 
          if ($counter == $page) 
            $pagination.= "<span class=\"current\">$counter</span>"; 
          else 
            $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
        } 
        $pagination.= "..."; 
        $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>"; 
        $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";     
      } 
      //in middle; hide some front and some back 
      elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) 
      { 
        $pagination.= "<a href=\"$targetpage"."page=1\">1</a>"; 
        $pagination.= "<a href=\"$targetpage"."page=2\">2</a>"; 
        $pagination.= "..."; 
        for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) 
        { 
          if ($counter == $page) 
            $pagination.= "<span class=\"current\">$counter</span>"; 
          else 
            $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
        } 
        $pagination.= "..."; 
        $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>"; 
        $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";     
      } 
      //close to end; only hide early pages 
      else 
      { 
        $pagination.= "<a href=\"$targetpage"."page=1\">1</a>"; 
        $pagination.= "<a href=\"$targetpage"."page=2\">2</a>"; 
        $pagination.= "..."; 
        for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) 
        { 
          if ($counter == $page) 
            $pagination.= "<span class=\"current\">$counter</span>"; 
          else 
            $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
        } 
      } 
    } 
     
    //next button 
    if ($page < $counter - 1) 
      $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>"; 
    else 
      $pagination.= "<span class=\"disabled\"> next »</span>"; 
    $pagination.= "</div>\n";     
  } 
?> 

  <?php 
    echo '<div id="ad-wrapper">'; 
    if($total_pages==0) echo "No Results for ".$char."!";
    else{
      $c = -1;
      while($row = mysql_fetch_array($result)) 
      { 
        if($c%$rows==$rows-1) echo "<br/>";
        echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
        $c++;
        $c++;
      } 
    }
}
  ?> 

<?php echo $pagination ?> 
</div></body> 
</html>
  1. <?php
  2.  
  3.   // How many adjacent pages should be shown on each side? 
  4.   $adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list) 
  5.   //how many items to show per page 
  6.   $limit = 10; 
  7.   //Number of ads per row
  8.   $rows = 3;
  9. ?>
  10.  
  11. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 
  12. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
  13. <head> 
  14. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> 
  15. <title>A To Z AD Navigation </title> 
  16. <style media="screen" type="text/css"> 
  17. html, body { }
  18. #aznavbar a:link { 
  19. color: #0C7FB0;
  20. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  21. margin-left: 4.15px;
  22. padding: 10px; 
  23. text-decoration:none; 
  24.  
  25. #aznavbar a:visited { 
  26. color: #0C7FB0;
  27. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  28. padding: 10px; 
  29. text-decoration:none; 
  30. #aznavbar a:hover {
  31. background-color: #FA6405;
  32. color:#000; 
  33. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  34. padding: 10px; 
  35. text-decoration:none; 
  36. #aznavbar a:active{ 
  37. color:#FA6405; 
  38. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  39. padding: 10px; 
  40. text-decoration:none; 
  41. }
  42. #aznavbar { 
  43.  background: #141414;
  44.  background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  45.  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  46.  background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  47.  background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  48.  background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  49.  background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  50.  filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
  51.  border: 1px solid #000; 
  52.  margin: -10px 0px 0px -8px;
  53.  padding: 10 0px 10px 80px;
  54.  width: 94.8%;
  55.  } 
  56. a:hover#showall { 
  57. #ad-wrapper{ 
  58.   margin:0px auto 0px auto; 
  59.   text-align:center; 
  60. }
  61. </style> 
  62. </head> 
  63. <body> 
  64. <div id="aznavbar" class="drop-shadow raised">
  65. <?php 
  66.   //This creates the menu at the top A-Z 
  67.   $char = $_GET['letter']; 
  68.   $list="num"; 
  69.   foreach (range('A', 'Z') as $i) $list.=",$i"; 
  70.   $list.=",Show All Ads"; 
  71.   $a = explode(',', $list); 
  72.   foreach ($a as $b) { 
  73.     if (!empty($b)) { 
  74.       if ($b=="num") { 
  75.         if ($char=="num") echo "<a href=\"az.php?letter=num\" target=\"frame\">#</a>"; 
  76.         else echo "<a href=\"az.php?letter=num\" target=\"frame\">#</a>"; 
  77.       } 
  78.       elseif ($b=="Show All Ads") { 
  79.         if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\" target=\"frame\">Show All Ads</a>"; 
  80.         else echo "<a href=\"az.php?letter=*\" target=\"frame\">Show All Ads</a>"; 
  81.       } 
  82.       elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\" target=\"frame\">$b</a>"; 
  83.       else echo "<a href=\"az.php?letter=".$b."\" target=\"frame\">$b</a>"; 
  84.     } 
  85.   } 
  86. ?> 
  87. </div>
  88. <?php 
  89. if(!empty($char)){
  90.   include('connect.php'); 
  91.   $tbl_name="amp_ads";    //your table name 
  92.    
  93.   /* 
  94.     First get total number of rows in data table. 
  95.     If you have a WHERE clause in your query, make sure you mirror it here. 
  96.   */ 
  97.   if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name"; 
  98.   elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'"; 
  99.   else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'"; 
  100.   $total_pages = mysql_fetch_array(mysql_query($query)); 
  101.   $total_pages = $total_pages[num]; 
  102.    
  103.   /* Setup vars for query. */ 
  104.   if(!empty($char)) $targetpage = "az.php?letter=$char&"; 
  105.   else $targetpage = "az.php?";   //your file name (the name of this file) 
  106.   $page = $_GET['page']; 
  107.   if($page) 
  108.     $start = ($page - 1) * $limit;       //first item to display on this page 
  109.   else 
  110.     $start = 0;                //if no page var is given, set start to 0 
  111.    
  112.   /* Get data. */ 
  113.   if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit"; 
  114.   elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit"; 
  115.   else $sql = "SELECT * FROM $tbl_name WHERE title LIKE '$char%' LIMIT $start, $limit"; 
  116.   $result = mysql_query($sql); 
  117.    
  118.   /* Setup page vars for display. */ 
  119.   if ($page == 0) $page = 1;          //if no page var is given, default to 1. 
  120.   $prev = $page - 1;              //previous page is page - 1 
  121.   $next = $page + 1;              //next page is page + 1 
  122.   $lastpage = ceil($total_pages/$limit);    //lastpage is = total pages / items per page, rounded up. 
  123.   $lpm1 = $lastpage - 1;            //last page minus 1 
  124.    
  125.   /* 
  126.     Now we apply our rules and draw the pagination object. 
  127.     We're actually saving the code to a variable in case we want to draw it more than once. 
  128.   */ 
  129.   $pagination = ""; 
  130.   if($lastpage > 1) 
  131.   {   
  132.     $pagination .= "<div class=\"pagination\">"; 
  133.     //previous button 
  134.     if ($page > 1) 
  135.       $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>"; 
  136.     else 
  137.       $pagination.= "<span class=\"disabled\">« previous </span>";   
  138.      
  139.     //pages   
  140.     if ($lastpage < 7 + ($adjacents * 2))  //not enough pages to bother breaking it up 
  141.     {   
  142.       for ($counter = 1; $counter <= $lastpage; $counter++) 
  143.       { 
  144.         if ($counter == $page) 
  145.           $pagination.= "<span class=\"current\">$counter</span>"; 
  146.         else 
  147.           $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
  148.       } 
  149.     } 
  150.     elseif($lastpage > 5 + ($adjacents * 2))  //enough pages to hide some 
  151.     { 
  152.       //close to beginning; only hide later pages 
  153.       if($page < 1 + ($adjacents * 2))     
  154.       { 
  155.         for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) 
  156.         { 
  157.           if ($counter == $page) 
  158.             $pagination.= "<span class=\"current\">$counter</span>"; 
  159.           else 
  160.             $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
  161.         } 
  162.         $pagination.= "..."; 
  163.         $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>"; 
  164.         $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";     
  165.       } 
  166.       //in middle; hide some front and some back 
  167.       elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) 
  168.       { 
  169.         $pagination.= "<a href=\"$targetpage"."page=1\">1</a>"; 
  170.         $pagination.= "<a href=\"$targetpage"."page=2\">2</a>"; 
  171.         $pagination.= "..."; 
  172.         for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) 
  173.         { 
  174.           if ($counter == $page) 
  175.             $pagination.= "<span class=\"current\">$counter</span>"; 
  176.           else 
  177.             $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
  178.         } 
  179.         $pagination.= "..."; 
  180.         $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>"; 
  181.         $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";     
  182.       } 
  183.       //close to end; only hide early pages 
  184.       else 
  185.       { 
  186.         $pagination.= "<a href=\"$targetpage"."page=1\">1</a>"; 
  187.         $pagination.= "<a href=\"$targetpage"."page=2\">2</a>"; 
  188.         $pagination.= "..."; 
  189.         for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) 
  190.         { 
  191.           if ($counter == $page) 
  192.             $pagination.= "<span class=\"current\">$counter</span>"; 
  193.           else 
  194.             $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
  195.         } 
  196.       } 
  197.     } 
  198.      
  199.     //next button 
  200.     if ($page < $counter - 1) 
  201.       $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>"; 
  202.     else 
  203.       $pagination.= "<span class=\"disabled\"> next »</span>"; 
  204.     $pagination.= "</div>\n";     
  205.   } 
  206. ?> 
  207.   <?php 
  208.     echo '<div id="ad-wrapper">'; 
  209.     if($total_pages==0) echo "No Results for ".$char."!";
  210.     else{
  211.       $c = -1;
  212.       while($row = mysql_fetch_array($result)) 
  213.       { 
  214.         if($c%$rows==$rows-1) echo "<br/>";
  215.         echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
  216.         $c++;
  217.         $c++;
  218.       } 
  219.     }
  220. }
  221.   ?> 
  222. <?php echo $pagination ?> 
  223. </div></body> 
  224. </html>


Remarque : Les deux pages php ci-dessus fonctionnent très bien sauf pour le fait que les liens dans le premier bloc de code qui est la php inclus alphabet naviation (notamment az.php) le deuxième bloc de code est l'endroit où le bloc de code doit être modifié--juste sous l'élément body dans le deuxième bloc de code, mais je suis naïf quant à ce qui doit être changé.

J'ai attendu si longtemps pour une solution à cela, je n'aime pas dire combien de temps...:oops:

Je vous remercie à l'avance !
Brian
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Décembre 31st, 2012, 6:27 pm

  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Inscription: Juil 06, 2010
  • Messages: 260
  • Status: Offline

Message Janvier 2nd, 2013, 7:36 am

avez-vous besoin de se débarrasser de le « ouverture dans une nouvelle page » tous ensemble ? dans l'affirmative dans le code qui génère les liens supprimer au paramètre cible. Voici le code que vous avez fourni sans le paramètre target. Non testés

index.php
PHP Code: [ Select ]
<html>
<head> <title> </title>
<meta name="viewport" content="initial-scale=1.0">
 
<link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
 
</head>
 
<body>
 
<?php include('az.php'); ?>
 
<div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
 
<div id="login">Login:&nbsp;<input type="username" class="login" size="20px;">
<br />
Password:&nbsp;<input class="login" type="password" size="20px">
<br />
Remember Me? <input type="checkbox">
 
<a href="#">Register Now For Free!</a>
 
<div class="note orange rounded">Start your Advertising or Publishing Campaign Now by simply clicking the Register Now button above!</div></div>
 
<?php
 
 
if($GET['frame'] == 1) {
 
//This creates the menu at the top A-Z  
    $char = $_GET['letter'];  
    $list="num";  
    foreach (range('A', 'Z') as $i) $list.=",$i";  
    $list.=",Show All Ads";  
    $a = explode(',', $list);  
    foreach ($a as $b) {  
        if (!empty($b)) {  
            if ($b=="num") {  
                if ($char=="num") echo "<a href=\"az.php?letter=num\">#</a>";  
                else echo "<a href=\"az.php?letter=num\">#</a>";  
            }  
            elseif ($b=="Show All Ads") {  
                if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\">Show All Ads</a>";  
                else echo "<a href=\"az.php?letter=*\">Show All Ads</a>";  
            }  
            elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\">$b</a>";  
            else echo "<a href=\"az.php?letter=".$b."\">$b</a>";  
        }  
    }
 
}
 
?>
 
<iframe name="frame">Sorry, you need the newest browser to display iframes!</iframe>
 
</body>
</html>
 
  1. <html>
  2. <head> <title> </title>
  3. <meta name="viewport" content="initial-scale=1.0">
  4.  
  5. <link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
  6. <link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
  7. <link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
  8.  
  9. </head>
  10.  
  11. <body>
  12.  
  13. <?php include('az.php'); ?>
  14.  
  15. <div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
  16.  
  17. <div id="login">Login:&nbsp;<input type="username" class="login" size="20px;">
  18. <br />
  19. Password:&nbsp;<input class="login" type="password" size="20px">
  20. <br />
  21. Remember Me? <input type="checkbox">
  22.  
  23. <a href="#">Register Now For Free!</a>
  24.  
  25. <div class="note orange rounded">Start your Advertising or Publishing Campaign Now by simply clicking the Register Now button above!</div></div>
  26.  
  27. <?php
  28.  
  29.  
  30. if($GET['frame'] == 1) {
  31.  
  32. //This creates the menu at the top A-Z  
  33.     $char = $_GET['letter'];  
  34.     $list="num";  
  35.     foreach (range('A', 'Z') as $i) $list.=",$i";  
  36.     $list.=",Show All Ads";  
  37.     $a = explode(',', $list);  
  38.     foreach ($a as $b) {  
  39.         if (!empty($b)) {  
  40.             if ($b=="num") {  
  41.                 if ($char=="num") echo "<a href=\"az.php?letter=num\">#</a>";  
  42.                 else echo "<a href=\"az.php?letter=num\">#</a>";  
  43.             }  
  44.             elseif ($b=="Show All Ads") {  
  45.                 if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\">Show All Ads</a>";  
  46.                 else echo "<a href=\"az.php?letter=*\">Show All Ads</a>";  
  47.             }  
  48.             elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\">$b</a>";  
  49.             else echo "<a href=\"az.php?letter=".$b."\">$b</a>";  
  50.         }  
  51.     }
  52.  
  53. }
  54.  
  55. ?>
  56.  
  57. <iframe name="frame">Sorry, you need the newest browser to display iframes!</iframe>
  58.  
  59. </body>
  60. </html>
  61.  



et Im en supposant que az.php
PHP Code: [ Select ]
<?php
 
    // How many adjacent pages should be shown on each side?  
    $adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)  
 
    //how many items to show per page  
    $limit = 10;  
 
    //Number of ads per row
    $rows = 3;
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
<head>  
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />  
 
<title>A To Z AD Navigation </title>  
 
<style media="screen" type="text/css">  
 
html, body { }
 
#aznavbar a:link {  
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px;  
text-decoration:none;  
}  
   
#aznavbar a:visited {  
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;  
text-decoration:none;  
}  
 
 
#aznavbar a:hover {
background-color: #FA6405;
color:#000;  
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;  
text-decoration:none;  
}  
 
 
#aznavbar a:active{  
color:#FA6405;  
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;  
text-decoration:none;  
}
 
#aznavbar {  
  background: #141414;
  background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
  border: 1px solid #000;  
  margin: -10px 0px 0px -8px;
  padding: 10 0px 10px 80px;
  width: 94.8%;
  }  
 
a:hover#showall {  
}  
 
#ad-wrapper{  
    margin:0px auto 0px auto;  
    text-align:center;  
}
 
</style>  
</head>  
 
<body>  
 
 
<div id="aznavbar" class="drop-shadow raised">
 
 
<?php  
    //This creates the menu at the top A-Z  
    $char = $_GET['letter'];  
    $list="num";  
    foreach (range('A', 'Z') as $i) $list.=",$i";  
    $list.=",Show All Ads";  
    $a = explode(',', $list);  
    foreach ($a as $b) {  
        if (!empty($b)) {  
            if ($b=="num") {  
                if ($char=="num") echo "<a href=\"az.php?letter=num\">#</a>";  
                else echo "<a href=\"az.php?letter=num\">#</a>";  
            }  
            elseif ($b=="Show All Ads") {  
                if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\">Show All Ads</a>";  
                else echo "<a href=\"az.php?letter=*\">Show All Ads</a>";  
            }  
            elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\">$b</a>";  
            else echo "<a href=\"az.php?letter=".$b."\">$b</a>";  
        }  
    }  
?>  
</div>
 
<?php  
if(!empty($char)){
    include('connect.php');  
    $tbl_name="amp_ads";        //your table name  
     
    /*  
       First get total number of rows in data table.  
       If you have a WHERE clause in your query, make sure you mirror it here.  
    */  
    if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";  
    elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";  
    else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";  
    $total_pages = mysql_fetch_array(mysql_query($query));  
    $total_pages = $total_pages[num];  
     
    /* Setup vars for query. */  
    if(!empty($char)) $targetpage = "az.php?letter=$char&";  
    else $targetpage = "az.php?";     //your file name  (the name of this file)  
    $page = $_GET['page'];  
    if($page)  
        $start = ($page - 1) * $limit;             //first item to display on this page  
    else  
        $start = 0;                                //if no page var is given, set start to 0  
     
    /* Get data. */  
    if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";  
    elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";  
    else $sql = "SELECT * FROM $tbl_name  WHERE title LIKE '$char%' LIMIT $start, $limit";  
    $result = mysql_query($sql);  
     
    /* Setup page vars for display. */  
    if ($page == 0) $page = 1;                    //if no page var is given, default to 1.  
    $prev = $page - 1;                            //previous page is page - 1  
    $next = $page + 1;                            //next page is page + 1  
    $lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.  
    $lpm1 = $lastpage - 1;                        //last page minus 1  
     
    /*  
        Now we apply our rules and draw the pagination object.  
        We're actually saving the code to a variable in case we want to draw it more than once.  
    */  
    $pagination = "";  
    if($lastpage > 1)  
    {      
        $pagination .= "<div class=\"pagination\">";  
        //previous button  
        if ($page > 1)  
            $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";  
        else  
            $pagination.= "<span class=\"disabled\">« previous </span>";      
         
        //pages      
        if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up  
        {      
            for ($counter = 1; $counter <= $lastpage; $counter++)  
            {  
                if ($counter == $page)  
                    $pagination.= "<span class=\"current\">$counter</span>";  
                else  
                    $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
            }  
        }  
        elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some  
        {  
            //close to beginning; only hide later pages  
            if($page < 1 + ($adjacents * 2))          
            {  
                for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)  
                {  
                    if ($counter == $page)  
                        $pagination.= "<span class=\"current\">$counter</span>";  
                    else  
                        $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
                }  
                $pagination.= "...";  
                $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
            }  
            //in middle; hide some front and some back  
            elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))  
            {  
                $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
                $pagination.= "...";  
                for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)  
                {  
                    if ($counter == $page)  
                        $pagination.= "<span class=\"current\">$counter</span>";  
                    else  
                        $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
                }  
                $pagination.= "...";  
                $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
            }  
            //close to end; only hide early pages  
            else  
            {  
                $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
                $pagination.= "...";  
                for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)  
                {  
                    if ($counter == $page)  
                        $pagination.= "<span class=\"current\">$counter</span>";  
                    else  
                        $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
                }  
            }  
        }  
         
        //next button  
        if ($page < $counter - 1)  
            $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";  
        else  
            $pagination.= "<span class=\"disabled\"> next »</span>";  
        $pagination.= "</div>\n";          
    }  
?>  
 
    <?php  
        echo '<div id="ad-wrapper">';  
        if($total_pages==0) echo "No Results for ".$char."!";
        else{
            $c = -1;
            while($row = mysql_fetch_array($result))  
            {  
                if($c%$rows==$rows-1) echo "<br/>";
                echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
                $c++;
                $c++;
            }  
        }
}
    ?>  
 
<?php echo $pagination ?>  
</div></body>  
</html>
 
  1. <?php
  2.  
  3.     // How many adjacent pages should be shown on each side?  
  4.     $adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)  
  5.  
  6.     //how many items to show per page  
  7.     $limit = 10;  
  8.  
  9.     //Number of ads per row
  10.     $rows = 3;
  11. ?>
  12.  
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  
  14. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
  15. <head>  
  16. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />  
  17.  
  18. <title>A To Z AD Navigation </title>  
  19.  
  20. <style media="screen" type="text/css">  
  21.  
  22. html, body { }
  23.  
  24. #aznavbar a:link {  
  25. color: #0C7FB0;
  26. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  27. margin-left: 4.15px;
  28. padding: 10px;  
  29. text-decoration:none;  
  30. }  
  31.    
  32. #aznavbar a:visited {  
  33. color: #0C7FB0;
  34. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  35. padding: 10px;  
  36. text-decoration:none;  
  37. }  
  38.  
  39.  
  40. #aznavbar a:hover {
  41. background-color: #FA6405;
  42. color:#000;  
  43. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  44. padding: 10px;  
  45. text-decoration:none;  
  46. }  
  47.  
  48.  
  49. #aznavbar a:active{  
  50. color:#FA6405;  
  51. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  52. padding: 10px;  
  53. text-decoration:none;  
  54. }
  55.  
  56. #aznavbar {  
  57.   background: #141414;
  58.   background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  59.   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  60.   background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  61.   background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  62.   background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  63.   background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  64.   filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
  65.   border: 1px solid #000;  
  66.   margin: -10px 0px 0px -8px;
  67.   padding: 10 0px 10px 80px;
  68.   width: 94.8%;
  69.   }  
  70.  
  71. a:hover#showall {  
  72. }  
  73.  
  74. #ad-wrapper{  
  75.     margin:0px auto 0px auto;  
  76.     text-align:center;  
  77. }
  78.  
  79. </style>  
  80. </head>  
  81.  
  82. <body>  
  83.  
  84.  
  85. <div id="aznavbar" class="drop-shadow raised">
  86.  
  87.  
  88. <?php  
  89.     //This creates the menu at the top A-Z  
  90.     $char = $_GET['letter'];  
  91.     $list="num";  
  92.     foreach (range('A', 'Z') as $i) $list.=",$i";  
  93.     $list.=",Show All Ads";  
  94.     $a = explode(',', $list);  
  95.     foreach ($a as $b) {  
  96.         if (!empty($b)) {  
  97.             if ($b=="num") {  
  98.                 if ($char=="num") echo "<a href=\"az.php?letter=num\">#</a>";  
  99.                 else echo "<a href=\"az.php?letter=num\">#</a>";  
  100.             }  
  101.             elseif ($b=="Show All Ads") {  
  102.                 if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\">Show All Ads</a>";  
  103.                 else echo "<a href=\"az.php?letter=*\">Show All Ads</a>";  
  104.             }  
  105.             elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\">$b</a>";  
  106.             else echo "<a href=\"az.php?letter=".$b."\">$b</a>";  
  107.         }  
  108.     }  
  109. ?>  
  110. </div>
  111.  
  112. <?php  
  113. if(!empty($char)){
  114.     include('connect.php');  
  115.     $tbl_name="amp_ads";        //your table name  
  116.      
  117.     /*  
  118.        First get total number of rows in data table.  
  119.        If you have a WHERE clause in your query, make sure you mirror it here.  
  120.     */  
  121.     if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";  
  122.     elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";  
  123.     else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";  
  124.     $total_pages = mysql_fetch_array(mysql_query($query));  
  125.     $total_pages = $total_pages[num];  
  126.      
  127.     /* Setup vars for query. */  
  128.     if(!empty($char)) $targetpage = "az.php?letter=$char&";  
  129.     else $targetpage = "az.php?";     //your file name  (the name of this file)  
  130.     $page = $_GET['page'];  
  131.     if($page)  
  132.         $start = ($page - 1) * $limit;             //first item to display on this page  
  133.     else  
  134.         $start = 0;                                //if no page var is given, set start to 0  
  135.      
  136.     /* Get data. */  
  137.     if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";  
  138.     elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";  
  139.     else $sql = "SELECT * FROM $tbl_name  WHERE title LIKE '$char%' LIMIT $start, $limit";  
  140.     $result = mysql_query($sql);  
  141.      
  142.     /* Setup page vars for display. */  
  143.     if ($page == 0) $page = 1;                    //if no page var is given, default to 1.  
  144.     $prev = $page - 1;                            //previous page is page - 1  
  145.     $next = $page + 1;                            //next page is page + 1  
  146.     $lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.  
  147.     $lpm1 = $lastpage - 1;                        //last page minus 1  
  148.      
  149.     /*  
  150.         Now we apply our rules and draw the pagination object.  
  151.         We're actually saving the code to a variable in case we want to draw it more than once.  
  152.     */  
  153.     $pagination = "";  
  154.     if($lastpage > 1)  
  155.     {      
  156.         $pagination .= "<div class=\"pagination\">";  
  157.         //previous button  
  158.         if ($page > 1)  
  159.             $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";  
  160.         else  
  161.             $pagination.= "<span class=\"disabled\">« previous </span>";      
  162.          
  163.         //pages      
  164.         if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up  
  165.         {      
  166.             for ($counter = 1; $counter <= $lastpage; $counter++)  
  167.             {  
  168.                 if ($counter == $page)  
  169.                     $pagination.= "<span class=\"current\">$counter</span>";  
  170.                 else  
  171.                     $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  172.             }  
  173.         }  
  174.         elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some  
  175.         {  
  176.             //close to beginning; only hide later pages  
  177.             if($page < 1 + ($adjacents * 2))          
  178.             {  
  179.                 for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)  
  180.                 {  
  181.                     if ($counter == $page)  
  182.                         $pagination.= "<span class=\"current\">$counter</span>";  
  183.                     else  
  184.                         $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  185.                 }  
  186.                 $pagination.= "...";  
  187.                 $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
  188.                 $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
  189.             }  
  190.             //in middle; hide some front and some back  
  191.             elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))  
  192.             {  
  193.                 $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
  194.                 $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
  195.                 $pagination.= "...";  
  196.                 for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)  
  197.                 {  
  198.                     if ($counter == $page)  
  199.                         $pagination.= "<span class=\"current\">$counter</span>";  
  200.                     else  
  201.                         $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  202.                 }  
  203.                 $pagination.= "...";  
  204.                 $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
  205.                 $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
  206.             }  
  207.             //close to end; only hide early pages  
  208.             else  
  209.             {  
  210.                 $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
  211.                 $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
  212.                 $pagination.= "...";  
  213.                 for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)  
  214.                 {  
  215.                     if ($counter == $page)  
  216.                         $pagination.= "<span class=\"current\">$counter</span>";  
  217.                     else  
  218.                         $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  219.                 }  
  220.             }  
  221.         }  
  222.          
  223.         //next button  
  224.         if ($page < $counter - 1)  
  225.             $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";  
  226.         else  
  227.             $pagination.= "<span class=\"disabled\"> next »</span>";  
  228.         $pagination.= "</div>\n";          
  229.     }  
  230. ?>  
  231.  
  232.     <?php  
  233.         echo '<div id="ad-wrapper">';  
  234.         if($total_pages==0) echo "No Results for ".$char."!";
  235.         else{
  236.             $c = -1;
  237.             while($row = mysql_fetch_array($result))  
  238.             {  
  239.                 if($c%$rows==$rows-1) echo "<br/>";
  240.                 echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
  241.                 $c++;
  242.                 $c++;
  243.             }  
  244.         }
  245. }
  246.     ?>  
  247.  
  248. <?php echo $pagination ?>  
  249. </div></body>  
  250. </html>
  251.  
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Inscription: Jan 06, 2006
  • Messages: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Message Janvier 2nd, 2013, 8:35 am

Code fait toujours la même chose...j'ai mis la cible = partie « frame » dans la page az.php dans les liens situés dans cette région :

Quote:
//This crée le menu en haut de A à z


et quand je clique sur les liens dans la barre de navigation az, je reçois toujours la partie css ( #, a-z, afficher tous les liens) dans l'iframe, je ne veux pas que, juste le MySQL résultats partie...

Je * pense ** (sauf si je suis sur la pensée de toute cette affaire) la partie qui crée le menu az (liens) dans la page de az.php doit être supprimé et j'aurais besoin de créer une nouvelle barre de navigation (essentiellement en html et css, sans php) dans la page index.php, mais le reste du code dans le az.php devra être mis à jour pour refléter ces modifications.

J'espère que vous comprenez !
Merci encore !
Brian
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Inscription: Juil 06, 2010
  • Messages: 260
  • Status: Offline

Message Janvier 2nd, 2013, 9:08 am

Peut-être que je ne comprends pas ce que vous essayez d'accomplir. J'ai couru le code que j'ai mis dans mon dernier post, et outre les erreurs de mysql (puisque je n'ai pas cette partie du code) il ouvre le az.php dans la même fenêtre comme indice (commutateur de nombre total de pages).


Êtes-vous essayer de cibler seulement l'iframe avec la navigation et charger seulement les résultats dans l'iframe ?
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Inscription: Juil 06, 2010
  • Messages: 260
  • Status: Offline

Message Janvier 2nd, 2013, 9:28 am

Si tel est le cas, cependant, à l'aide de la même page, affectez le résultat et la navigation va vous donner un mal de tête. Les diviser en deux fichiers différents.

index.php
PHP Code: [ Select ]
<html>
<head> <title> </title>
<meta name="viewport" content="initial-scale=1.0">
 
<link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
<style media="screen" type="text/css">  
 
html, body { }
 
#aznavbar a:link {  
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px;  
text-decoration:none;  
}  
   
#aznavbar a:visited {  
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;  
text-decoration:none;  
}  
 
 
#aznavbar a:hover {
background-color: #FA6405;
color:#000;  
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;  
text-decoration:none;  
}  
 
 
#aznavbar a:active{  
color:#FA6405;  
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;  
text-decoration:none;  
}
 
#aznavbar {  
  background: #141414;
  background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
  border: 1px solid #000;  
  margin: -10px 0px 0px -8px;
  padding: 10 0px 10px 80px;
  width: 94.8%;
  }  
 
a:hover#showall {  
}  
 
#ad-wrapper{  
    margin:0px auto 0px auto;  
    text-align:center;  
}
 
</style>  
</head>
 
<body>
 
<?php include('az.php'); ?>
 
<div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
 
<div id="login">Login:&nbsp;<input type="username" class="login" size="20px;">
<br />
Password:&nbsp;<input class="login" type="password" size="20px">
<br />
Remember Me? <input type="checkbox">
 
<a href="#">Register Now For Free!</a>
 
<div class="note orange rounded">Start your Advertising or Publishing Campaign Now by simply clicking the Register Now button above!</div></div>
 
<iframe name="frame">Sorry, you need the newest browser to display iframes!</iframe>
 
</body>
</html>
 
  1. <html>
  2. <head> <title> </title>
  3. <meta name="viewport" content="initial-scale=1.0">
  4.  
  5. <link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
  6. <link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
  7. <link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
  8. <style media="screen" type="text/css">  
  9.  
  10. html, body { }
  11.  
  12. #aznavbar a:link {  
  13. color: #0C7FB0;
  14. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  15. margin-left: 4.15px;
  16. padding: 10px;  
  17. text-decoration:none;  
  18. }  
  19.    
  20. #aznavbar a:visited {  
  21. color: #0C7FB0;
  22. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  23. padding: 10px;  
  24. text-decoration:none;  
  25. }  
  26.  
  27.  
  28. #aznavbar a:hover {
  29. background-color: #FA6405;
  30. color:#000;  
  31. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  32. padding: 10px;  
  33. text-decoration:none;  
  34. }  
  35.  
  36.  
  37. #aznavbar a:active{  
  38. color:#FA6405;  
  39. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  40. padding: 10px;  
  41. text-decoration:none;  
  42. }
  43.  
  44. #aznavbar {  
  45.   background: #141414;
  46.   background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  47.   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  48.   background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  49.   background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  50.   background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  51.   background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  52.   filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
  53.   border: 1px solid #000;  
  54.   margin: -10px 0px 0px -8px;
  55.   padding: 10 0px 10px 80px;
  56.   width: 94.8%;
  57.   }  
  58.  
  59. a:hover#showall {  
  60. }  
  61.  
  62. #ad-wrapper{  
  63.     margin:0px auto 0px auto;  
  64.     text-align:center;  
  65. }
  66.  
  67. </style>  
  68. </head>
  69.  
  70. <body>
  71.  
  72. <?php include('az.php'); ?>
  73.  
  74. <div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
  75.  
  76. <div id="login">Login:&nbsp;<input type="username" class="login" size="20px;">
  77. <br />
  78. Password:&nbsp;<input class="login" type="password" size="20px">
  79. <br />
  80. Remember Me? <input type="checkbox">
  81.  
  82. <a href="#">Register Now For Free!</a>
  83.  
  84. <div class="note orange rounded">Start your Advertising or Publishing Campaign Now by simply clicking the Register Now button above!</div></div>
  85.  
  86. <iframe name="frame">Sorry, you need the newest browser to display iframes!</iframe>
  87.  
  88. </body>
  89. </html>
  90.  


AZ.php
PHP Code: [ Select ]
<div id="aznavbar" class="drop-shadow raised">
<?php  
    //This creates the menu at the top A-Z  
    $char = $_GET['letter'];  
    $list="num";  
    foreach (range('A', 'Z') as $i) $list.=",$i";  
    $list.=",Show All Ads";  
    $a = explode(',', $list);  
    foreach ($a as $b) {  
        if (!empty($b)) {  
            if ($b=="num") {  
                if ($char=="num") echo "<a href=\"results.php?letter=num\" target=\"frame\">#</a>";  
                else echo "<a href=\"results.php?letter=num\" target=\"frame\">#</a>";  
            }  
            elseif ($b=="Show All Ads") {  
                if (($char=="*")||(empty($char))) echo "<a href=\"results.php?letter=*\" target=\"frame\">Show All Ads</a>";  
                else echo "<a href=\"results.php?letter=*\" target=\"frame\">Show All Ads</a>";  
            }  
            elseif($b==$char) echo "<a href=\"results.php?letter=".$b."\" target=\"frame\">$b</a>";  
            else echo "<a href=\"results.php?letter=".$b."\" target=\"frame\">$b</a>";  
        }  
    }  
?>  
</div>
 
  1. <div id="aznavbar" class="drop-shadow raised">
  2. <?php  
  3.     //This creates the menu at the top A-Z  
  4.     $char = $_GET['letter'];  
  5.     $list="num";  
  6.     foreach (range('A', 'Z') as $i) $list.=",$i";  
  7.     $list.=",Show All Ads";  
  8.     $a = explode(',', $list);  
  9.     foreach ($a as $b) {  
  10.         if (!empty($b)) {  
  11.             if ($b=="num") {  
  12.                 if ($char=="num") echo "<a href=\"results.php?letter=num\" target=\"frame\">#</a>";  
  13.                 else echo "<a href=\"results.php?letter=num\" target=\"frame\">#</a>";  
  14.             }  
  15.             elseif ($b=="Show All Ads") {  
  16.                 if (($char=="*")||(empty($char))) echo "<a href=\"results.php?letter=*\" target=\"frame\">Show All Ads</a>";  
  17.                 else echo "<a href=\"results.php?letter=*\" target=\"frame\">Show All Ads</a>";  
  18.             }  
  19.             elseif($b==$char) echo "<a href=\"results.php?letter=".$b."\" target=\"frame\">$b</a>";  
  20.             else echo "<a href=\"results.php?letter=".$b."\" target=\"frame\">$b</a>";  
  21.         }  
  22.     }  
  23. ?>  
  24. </div>
  25.  


Results.php
PHP Code: [ Select ]
<?php
 
    // How many adjacent pages should be shown on each side?  
    $adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)  
 
    //how many items to show per page  
    $limit = 10;  
 
    //Number of ads per row
    $rows = 3;
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
<head>  
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />  
 
<title>A To Z AD Navigation </title>  
 
<style media="screen" type="text/css">  
 
html, body { }
 
#aznavbar a:link {  
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px;  
text-decoration:none;  
}  
   
#aznavbar a:visited {  
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;  
text-decoration:none;  
}  
 
 
#aznavbar a:hover {
background-color: #FA6405;
color:#000;  
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;  
text-decoration:none;  
}  
 
 
#aznavbar a:active{  
color:#FA6405;  
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;  
text-decoration:none;  
}
 
#aznavbar {  
  background: #141414;
  background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
  border: 1px solid #000;  
  margin: -10px 0px 0px -8px;
  padding: 10 0px 10px 80px;
  width: 94.8%;
  }  
 
a:hover#showall {  
}  
 
#ad-wrapper{  
    margin:0px auto 0px auto;  
    text-align:center;  
}
 
</style>  
</head>  
 
<body>
 
<?php  
//This creates the menu at the top A-Z  
$char = $_GET['letter'];  
$list="num";
   
if(!empty($char)){
    include('connect.php');  
    $tbl_name="amp_ads";        //your table name  
     
    /*  
       First get total number of rows in data table.  
       If you have a WHERE clause in your query, make sure you mirror it here.  
    */  
    if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";  
    elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";  
    else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";  
    $total_pages = mysql_fetch_array(mysql_query($query));  
    $total_pages = $total_pages[num];  
     
    /* Setup vars for query. */  
    if(!empty($char)) $targetpage = "results.php?letter=$char&";  
    else $targetpage = "az.php?";     //your file name  (the name of this file)  
    $page = $_GET['page'];  
    if($page)  
        $start = ($page - 1) * $limit;             //first item to display on this page  
    else  
        $start = 0;                                //if no page var is given, set start to 0  
     
    /* Get data. */  
    if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";  
    elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";  
    else $sql = "SELECT * FROM $tbl_name  WHERE title LIKE '$char%' LIMIT $start, $limit";  
    $result = mysql_query($sql);  
     
    /* Setup page vars for display. */  
    if ($page == 0) $page = 1;                    //if no page var is given, default to 1.  
    $prev = $page - 1;                            //previous page is page - 1  
    $next = $page + 1;                            //next page is page + 1  
    $lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.  
    $lpm1 = $lastpage - 1;                        //last page minus 1  
     
    /*  
        Now we apply our rules and draw the pagination object.  
        We're actually saving the code to a variable in case we want to draw it more than once.  
    */  
    $pagination = "";  
    if($lastpage > 1)  
    {      
        $pagination .= "<div class=\"pagination\">";  
        //previous button  
        if ($page > 1)  
            $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";  
        else  
            $pagination.= "<span class=\"disabled\">« previous </span>";      
         
        //pages      
        if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up  
        {      
            for ($counter = 1; $counter <= $lastpage; $counter++)  
            {  
                if ($counter == $page)  
                    $pagination.= "<span class=\"current\">$counter</span>";  
                else  
                    $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
            }  
        }  
        elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some  
        {  
            //close to beginning; only hide later pages  
            if($page < 1 + ($adjacents * 2))          
            {  
                for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)  
                {  
                    if ($counter == $page)  
                        $pagination.= "<span class=\"current\">$counter</span>";  
                    else  
                        $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
                }  
                $pagination.= "...";  
                $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
            }  
            //in middle; hide some front and some back  
            elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))  
            {  
                $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
                $pagination.= "...";  
                for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)  
                {  
                    if ($counter == $page)  
                        $pagination.= "<span class=\"current\">$counter</span>";  
                    else  
                        $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
                }  
                $pagination.= "...";  
                $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
            }  
            //close to end; only hide early pages  
            else  
            {  
                $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
                $pagination.= "...";  
                for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)  
                {  
                    if ($counter == $page)  
                        $pagination.= "<span class=\"current\">$counter</span>";  
                    else  
                        $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
                }  
            }  
        }  
         
        //next button  
        if ($page < $counter - 1)  
            $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";  
        else  
            $pagination.= "<span class=\"disabled\"> next »</span>";  
        $pagination.= "</div>\n";          
    }  
?>  
 
    <?php  
        echo '<div id="ad-wrapper">';  
        if($total_pages==0) echo "No Results for ".$char."!";
        else{
            $c = -1;
            while($row = mysql_fetch_array($result))  
            {  
                if($c%$rows==$rows-1) echo "<br/>";
                echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
                $c++;
                $c++;
            }  
        }
}
    ?>  
 
<?php echo $pagination ?>  
</body>  
</html>
 
  1. <?php
  2.  
  3.     // How many adjacent pages should be shown on each side?  
  4.     $adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)  
  5.  
  6.     //how many items to show per page  
  7.     $limit = 10;  
  8.  
  9.     //Number of ads per row
  10.     $rows = 3;
  11. ?>
  12.  
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  
  14. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
  15. <head>  
  16. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />  
  17.  
  18. <title>A To Z AD Navigation </title>  
  19.  
  20. <style media="screen" type="text/css">  
  21.  
  22. html, body { }
  23.  
  24. #aznavbar a:link {  
  25. color: #0C7FB0;
  26. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  27. margin-left: 4.15px;
  28. padding: 10px;  
  29. text-decoration:none;  
  30. }  
  31.    
  32. #aznavbar a:visited {  
  33. color: #0C7FB0;
  34. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  35. padding: 10px;  
  36. text-decoration:none;  
  37. }  
  38.  
  39.  
  40. #aznavbar a:hover {
  41. background-color: #FA6405;
  42. color:#000;  
  43. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  44. padding: 10px;  
  45. text-decoration:none;  
  46. }  
  47.  
  48.  
  49. #aznavbar a:active{  
  50. color:#FA6405;  
  51. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  52. padding: 10px;  
  53. text-decoration:none;  
  54. }
  55.  
  56. #aznavbar {  
  57.   background: #141414;
  58.   background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  59.   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  60.   background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  61.   background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  62.   background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  63.   background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  64.   filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
  65.   border: 1px solid #000;  
  66.   margin: -10px 0px 0px -8px;
  67.   padding: 10 0px 10px 80px;
  68.   width: 94.8%;
  69.   }  
  70.  
  71. a:hover#showall {  
  72. }  
  73.  
  74. #ad-wrapper{  
  75.     margin:0px auto 0px auto;  
  76.     text-align:center;  
  77. }
  78.  
  79. </style>  
  80. </head>  
  81.  
  82. <body>
  83.  
  84. <?php  
  85. //This creates the menu at the top A-Z  
  86. $char = $_GET['letter'];  
  87. $list="num";
  88.    
  89. if(!empty($char)){
  90.     include('connect.php');  
  91.     $tbl_name="amp_ads";        //your table name  
  92.      
  93.     /*  
  94.        First get total number of rows in data table.  
  95.        If you have a WHERE clause in your query, make sure you mirror it here.  
  96.     */  
  97.     if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";  
  98.     elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";  
  99.     else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";  
  100.     $total_pages = mysql_fetch_array(mysql_query($query));  
  101.     $total_pages = $total_pages[num];  
  102.      
  103.     /* Setup vars for query. */  
  104.     if(!empty($char)) $targetpage = "results.php?letter=$char&";  
  105.     else $targetpage = "az.php?";     //your file name  (the name of this file)  
  106.     $page = $_GET['page'];  
  107.     if($page)  
  108.         $start = ($page - 1) * $limit;             //first item to display on this page  
  109.     else  
  110.         $start = 0;                                //if no page var is given, set start to 0  
  111.      
  112.     /* Get data. */  
  113.     if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";  
  114.     elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";  
  115.     else $sql = "SELECT * FROM $tbl_name  WHERE title LIKE '$char%' LIMIT $start, $limit";  
  116.     $result = mysql_query($sql);  
  117.      
  118.     /* Setup page vars for display. */  
  119.     if ($page == 0) $page = 1;                    //if no page var is given, default to 1.  
  120.     $prev = $page - 1;                            //previous page is page - 1  
  121.     $next = $page + 1;                            //next page is page + 1  
  122.     $lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.  
  123.     $lpm1 = $lastpage - 1;                        //last page minus 1  
  124.      
  125.     /*  
  126.         Now we apply our rules and draw the pagination object.  
  127.         We're actually saving the code to a variable in case we want to draw it more than once.  
  128.     */  
  129.     $pagination = "";  
  130.     if($lastpage > 1)  
  131.     {      
  132.         $pagination .= "<div class=\"pagination\">";  
  133.         //previous button  
  134.         if ($page > 1)  
  135.             $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";  
  136.         else  
  137.             $pagination.= "<span class=\"disabled\">« previous </span>";      
  138.          
  139.         //pages      
  140.         if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up  
  141.         {      
  142.             for ($counter = 1; $counter <= $lastpage; $counter++)  
  143.             {  
  144.                 if ($counter == $page)  
  145.                     $pagination.= "<span class=\"current\">$counter</span>";  
  146.                 else  
  147.                     $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  148.             }  
  149.         }  
  150.         elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some  
  151.         {  
  152.             //close to beginning; only hide later pages  
  153.             if($page < 1 + ($adjacents * 2))          
  154.             {  
  155.                 for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)  
  156.                 {  
  157.                     if ($counter == $page)  
  158.                         $pagination.= "<span class=\"current\">$counter</span>";  
  159.                     else  
  160.                         $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  161.                 }  
  162.                 $pagination.= "...";  
  163.                 $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
  164.                 $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
  165.             }  
  166.             //in middle; hide some front and some back  
  167.             elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))  
  168.             {  
  169.                 $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
  170.                 $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
  171.                 $pagination.= "...";  
  172.                 for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)  
  173.                 {  
  174.                     if ($counter == $page)  
  175.                         $pagination.= "<span class=\"current\">$counter</span>";  
  176.                     else  
  177.                         $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  178.                 }  
  179.                 $pagination.= "...";  
  180.                 $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
  181.                 $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
  182.             }  
  183.             //close to end; only hide early pages  
  184.             else  
  185.             {  
  186.                 $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
  187.                 $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
  188.                 $pagination.= "...";  
  189.                 for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)  
  190.                 {  
  191.                     if ($counter == $page)  
  192.                         $pagination.= "<span class=\"current\">$counter</span>";  
  193.                     else  
  194.                         $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  195.                 }  
  196.             }  
  197.         }  
  198.          
  199.         //next button  
  200.         if ($page < $counter - 1)  
  201.             $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";  
  202.         else  
  203.             $pagination.= "<span class=\"disabled\"> next »</span>";  
  204.         $pagination.= "</div>\n";          
  205.     }  
  206. ?>  
  207.  
  208.     <?php  
  209.         echo '<div id="ad-wrapper">';  
  210.         if($total_pages==0) echo "No Results for ".$char."!";
  211.         else{
  212.             $c = -1;
  213.             while($row = mysql_fetch_array($result))  
  214.             {  
  215.                 if($c%$rows==$rows-1) echo "<br/>";
  216.                 echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
  217.                 $c++;
  218.                 $c++;
  219.             }  
  220.         }
  221. }
  222.     ?>  
  223.  
  224. <?php echo $pagination ?>  
  225. </body>  
  226. </html>
  227.  
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Inscription: Jan 06, 2006
  • Messages: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Message Janvier 2nd, 2013, 10:02 am

Salut Scott,

Ça marche!!

Je vous remercie tellement, si je peux vous offrir un peu d'argent par paypal, envoyez moi un message.

Merci encore,
et Happy New Year !

-Brian
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Inscription: Juil 06, 2010
  • Messages: 260
  • Status: Offline

Message Janvier 2nd, 2013, 10:07 am

Pas besoin . Im heureux d'aider et de vous avoir une bonne année ainsi.
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Inscription: Jan 06, 2006
  • Messages: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Message Janvier 2nd, 2013, 11:03 am

Salut Scott,

Hate de vous déranger, et je n'ai pas * pense ** sa que les grandes d'un accord pour le faire, mais au lieu d'ouverture dans l'iframe, pouvez-vous m'aider Ouvrez-le dans la div php "switch" ? Motif : La hauteur de l'iframe, je pense que vous savez le reste...Dont vous souhaitez utiliser javascript pour quelque chose comme ça.:|

Heres un peu de code de « switch » qui fonctionne :

Code: [ Select ]

<style type="text/css">

#target {
width: 300px;
height: 300px;
background-color: #00FFCC;
border: 1px solid #000;
text-align: center;
vertical-align:middle;
margin: 0 auto;
padding: 10px; }

</style>

<body>

<a href="index.php?page=main">page1</a>
<a href="index.php?page=2"><br />page2</a>
<a href="index.php?page=3"><br />page3</a>
<p />

<div id="target">

<?php

switch ($_GET['page'])

{
case "main": include '1.php'; break;
case "2": include '2.php'; break;
case "3": include '3.php'; break;

default: include '1.php';
}

?>
</div>

</body>
</html>
  1. <style type="text/css">
  2. #target {
  3. width: 300px;
  4. height: 300px;
  5. background-color: #00FFCC;
  6. border: 1px solid #000;
  7. text-align: center;
  8. vertical-align:middle;
  9. margin: 0 auto;
  10. padding: 10px; }
  11. </style>
  12. <body>
  13. <a href="index.php?page=main">page1</a>
  14. <a href="index.php?page=2"><br />page2</a>
  15. <a href="index.php?page=3"><br />page3</a>
  16. <p />
  17. <div id="target">
  18. <?php
  19. switch ($_GET['page'])
  20. {
  21. case "main": include '1.php'; break;
  22. case "2": include '2.php'; break;
  23. case "3": include '3.php'; break;
  24. default: include '1.php';
  25. }
  26. ?>
  27. </div>
  28. </body>
  29. </html>
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Inscription: Juil 06, 2010
  • Messages: 260
  • Status: Offline

Message Janvier 2nd, 2013, 11:12 am

Vous devriez être en mesure de changer le results.php à cette

PHP Code: [ Select ]
<?php
 
// How many adjacent pages should be shown on each side?  
$adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)  
 
//how many items to show per page  
$limit = 10;  
 
//Number of ads per row
$rows = 3;
 
//This creates the menu at the top A-Z  
$char = $_GET['letter'];  
$list="num";
   
if(!empty($char)){
    include('connect.php');  
    $tbl_name="amp_ads";        //your table name  
     
    /*  
       First get total number of rows in data table.  
       If you have a WHERE clause in your query, make sure you mirror it here.  
    */  
    if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";  
    elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";  
    else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";  
    $total_pages = mysql_fetch_array(mysql_query($query));  
    $total_pages = $total_pages[num];  
     
    /* Setup vars for query. */  
    if(!empty($char)) $targetpage = "results.php?letter=$char&";  
    else $targetpage = "az.php?";     //your file name  (the name of this file)  
    $page = $_GET['page'];  
    if($page)  
        $start = ($page - 1) * $limit;             //first item to display on this page  
    else  
        $start = 0;                                //if no page var is given, set start to 0  
     
    /* Get data. */  
    if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";  
    elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";  
    else $sql = "SELECT * FROM $tbl_name  WHERE title LIKE '$char%' LIMIT $start, $limit";  
    $result = mysql_query($sql);  
     
    /* Setup page vars for display. */  
    if ($page == 0) $page = 1;                    //if no page var is given, default to 1.  
    $prev = $page - 1;                            //previous page is page - 1  
    $next = $page + 1;                            //next page is page + 1  
    $lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.  
    $lpm1 = $lastpage - 1;                        //last page minus 1  
     
    /*  
        Now we apply our rules and draw the pagination object.  
        We're actually saving the code to a variable in case we want to draw it more than once.  
    */  
    $pagination = "";  
    if($lastpage > 1)  
    {      
        $pagination .= "<div class=\"pagination\">";  
        //previous button  
        if ($page > 1)  
            $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";  
        else  
            $pagination.= "<span class=\"disabled\">« previous </span>";      
         
        //pages      
        if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up  
        {      
            for ($counter = 1; $counter <= $lastpage; $counter++)  
            {  
                if ($counter == $page)  
                    $pagination.= "<span class=\"current\">$counter</span>";  
                else  
                    $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
            }  
        }  
        elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some  
        {  
            //close to beginning; only hide later pages  
            if($page < 1 + ($adjacents * 2))          
            {  
                for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)  
                {  
                    if ($counter == $page)  
                        $pagination.= "<span class=\"current\">$counter</span>";  
                    else  
                        $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
                }  
                $pagination.= "...";  
                $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
            }  
            //in middle; hide some front and some back  
            elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))  
            {  
                $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
                $pagination.= "...";  
                for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)  
                {  
                    if ($counter == $page)  
                        $pagination.= "<span class=\"current\">$counter</span>";  
                    else  
                        $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
                }  
                $pagination.= "...";  
                $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
            }  
            //close to end; only hide early pages  
            else  
            {  
                $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
                $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
                $pagination.= "...";  
                for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)  
                {  
                    if ($counter == $page)  
                        $pagination.= "<span class=\"current\">$counter</span>";  
                    else  
                        $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
                }  
            }  
        }  
         
        //next button  
        if ($page < $counter - 1)  
            $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";  
        else  
            $pagination.= "<span class=\"disabled\"> next »</span>";  
        $pagination.= "</div>\n";          
    }  
   
        echo '<div id="ad-wrapper">';  
        if($total_pages==0) echo "No Results for ".$char."!";
        else{
            $c = -1;
            while($row = mysql_fetch_array($result))  
            {  
                if($c%$rows==$rows-1) echo "<br/>";
                echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
                $c++;
                $c++;
            }  
        }
}
 
echo $pagination;
 
?>
 
  1. <?php
  2.  
  3. // How many adjacent pages should be shown on each side?  
  4. $adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)  
  5.  
  6. //how many items to show per page  
  7. $limit = 10;  
  8.  
  9. //Number of ads per row
  10. $rows = 3;
  11.  
  12. //This creates the menu at the top A-Z  
  13. $char = $_GET['letter'];  
  14. $list="num";
  15.    
  16. if(!empty($char)){
  17.     include('connect.php');  
  18.     $tbl_name="amp_ads";        //your table name  
  19.      
  20.     /*  
  21.        First get total number of rows in data table.  
  22.        If you have a WHERE clause in your query, make sure you mirror it here.  
  23.     */  
  24.     if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";  
  25.     elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";  
  26.     else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";  
  27.     $total_pages = mysql_fetch_array(mysql_query($query));  
  28.     $total_pages = $total_pages[num];  
  29.      
  30.     /* Setup vars for query. */  
  31.     if(!empty($char)) $targetpage = "results.php?letter=$char&";  
  32.     else $targetpage = "az.php?";     //your file name  (the name of this file)  
  33.     $page = $_GET['page'];  
  34.     if($page)  
  35.         $start = ($page - 1) * $limit;             //first item to display on this page  
  36.     else  
  37.         $start = 0;                                //if no page var is given, set start to 0  
  38.      
  39.     /* Get data. */  
  40.     if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";  
  41.     elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";  
  42.     else $sql = "SELECT * FROM $tbl_name  WHERE title LIKE '$char%' LIMIT $start, $limit";  
  43.     $result = mysql_query($sql);  
  44.      
  45.     /* Setup page vars for display. */  
  46.     if ($page == 0) $page = 1;                    //if no page var is given, default to 1.  
  47.     $prev = $page - 1;                            //previous page is page - 1  
  48.     $next = $page + 1;                            //next page is page + 1  
  49.     $lastpage = ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.  
  50.     $lpm1 = $lastpage - 1;                        //last page minus 1  
  51.      
  52.     /*  
  53.         Now we apply our rules and draw the pagination object.  
  54.         We're actually saving the code to a variable in case we want to draw it more than once.  
  55.     */  
  56.     $pagination = "";  
  57.     if($lastpage > 1)  
  58.     {      
  59.         $pagination .= "<div class=\"pagination\">";  
  60.         //previous button  
  61.         if ($page > 1)  
  62.             $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";  
  63.         else  
  64.             $pagination.= "<span class=\"disabled\">« previous </span>";      
  65.          
  66.         //pages      
  67.         if ($lastpage < 7 + ($adjacents * 2))    //not enough pages to bother breaking it up  
  68.         {      
  69.             for ($counter = 1; $counter <= $lastpage; $counter++)  
  70.             {  
  71.                 if ($counter == $page)  
  72.                     $pagination.= "<span class=\"current\">$counter</span>";  
  73.                 else  
  74.                     $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  75.             }  
  76.         }  
  77.         elseif($lastpage > 5 + ($adjacents * 2))    //enough pages to hide some  
  78.         {  
  79.             //close to beginning; only hide later pages  
  80.             if($page < 1 + ($adjacents * 2))          
  81.             {  
  82.                 for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)  
  83.                 {  
  84.                     if ($counter == $page)  
  85.                         $pagination.= "<span class=\"current\">$counter</span>";  
  86.                     else  
  87.                         $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  88.                 }  
  89.                 $pagination.= "...";  
  90.                 $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
  91.                 $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
  92.             }  
  93.             //in middle; hide some front and some back  
  94.             elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))  
  95.             {  
  96.                 $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
  97.                 $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
  98.                 $pagination.= "...";  
  99.                 for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)  
  100.                 {  
  101.                     if ($counter == $page)  
  102.                         $pagination.= "<span class=\"current\">$counter</span>";  
  103.                     else  
  104.                         $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  105.                 }  
  106.                 $pagination.= "...";  
  107.                 $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";  
  108.                 $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";          
  109.             }  
  110.             //close to end; only hide early pages  
  111.             else  
  112.             {  
  113.                 $pagination.= "<a href=\"$targetpage"."page=1\">1</a>";  
  114.                 $pagination.= "<a href=\"$targetpage"."page=2\">2</a>";  
  115.                 $pagination.= "...";  
  116.                 for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)  
  117.                 {  
  118.                     if ($counter == $page)  
  119.                         $pagination.= "<span class=\"current\">$counter</span>";  
  120.                     else  
  121.                         $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";                      
  122.                 }  
  123.             }  
  124.         }  
  125.          
  126.         //next button  
  127.         if ($page < $counter - 1)  
  128.             $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";  
  129.         else  
  130.             $pagination.= "<span class=\"disabled\"> next »</span>";  
  131.         $pagination.= "</div>\n";          
  132.     }  
  133.    
  134.         echo '<div id="ad-wrapper">';  
  135.         if($total_pages==0) echo "No Results for ".$char."!";
  136.         else{
  137.             $c = -1;
  138.             while($row = mysql_fetch_array($result))  
  139.             {  
  140.                 if($c%$rows==$rows-1) echo "<br/>";
  141.                 echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
  142.                 $c++;
  143.                 $c++;
  144.             }  
  145.         }
  146. }
  147.  
  148. echo $pagination;
  149.  
  150. ?>
  151.  


et il suffit d'inclure dans la balise div

Code: [ Select ]
<div id="target">
<?php
include 'results.php';
?>
</div>
  1. <div id="target">
  2. <?php
  3. include 'results.php';
  4. ?>
  5. </div>


Si Im ne me trompé les résultats page retourne nothing si les variables ne sont pas le programme d'installation.
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Inscription: Jan 06, 2006
  • Messages: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Message Janvier 2nd, 2013, 11:23 am

J'ai essayé ça et les résultats s'ouvrent dans le tape pas de fenêtre (pas de nouvelle fenêtre)...je suis en train de la &lt; div id = « cible » &gt;&lt; / div &gt;

Une autre chance ?
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Inscription: Juil 06, 2010
  • Messages: 260
  • Status: Offline

Message Janvier 2nd, 2013, 11:30 am

Désolé, j'ai envoyé que sur non testé, j'ai oublié d'ajouter quelques petites choses

J'ai raté quelque chose dans le results.php
Code: [ Select ]
<?php
 
// How many adjacent pages should be shown on each side? 
$adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list) 

//how many items to show per page 
$limit = 10; 

//Number of ads per row
$rows = 3;

//This creates the menu at the top A-Z 
$char = $_GET['letter']; 
$list="num";
    
if(!empty($char)){
  include('connect.php'); 
  $tbl_name="amp_ads";    //your table name 
   
  /* 
    First get total number of rows in data table. 
    If you have a WHERE clause in your query, make sure you mirror it here. 
  */ 
  if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name"; 
  elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'"; 
  else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'"; 
  $total_pages = mysql_fetch_array(mysql_query($query)); 
  $total_pages = $total_pages[num]; 
   
  /* Setup vars for query. */ 
  if(!empty($char)) $targetpage = $_SERVER['PHP_SELF'] . "?letter=$char&"; 
  else $targetpage = "az.php?";   //your file name (the name of this file) 
  $page = $_GET['page']; 
  if($page) 
    $start = ($page - 1) * $limit;       //first item to display on this page 
  else 
    $start = 0;                //if no page var is given, set start to 0 
   
  /* Get data. */ 
  if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit"; 
  elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit"; 
  else $sql = "SELECT * FROM $tbl_name WHERE title LIKE '$char%' LIMIT $start, $limit"; 
  $result = mysql_query($sql); 
   
  /* Setup page vars for display. */ 
  if ($page == 0) $page = 1;          //if no page var is given, default to 1. 
  $prev = $page - 1;              //previous page is page - 1 
  $next = $page + 1;              //next page is page + 1 
  $lastpage = ceil($total_pages/$limit);    //lastpage is = total pages / items per page, rounded up. 
  $lpm1 = $lastpage - 1;            //last page minus 1 
   
  /* 
    Now we apply our rules and draw the pagination object. 
    We're actually saving the code to a variable in case we want to draw it more than once. 
  */ 
  $pagination = ""; 
  if($lastpage > 1) 
  {   
    $pagination .= "<div class=\"pagination\">"; 
    //previous button 
    if ($page > 1) 
      $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>"; 
    else 
      $pagination.= "<span class=\"disabled\">« previous </span>";   
     
    //pages   
    if ($lastpage < 7 + ($adjacents * 2))  //not enough pages to bother breaking it up 
    {   
      for ($counter = 1; $counter <= $lastpage; $counter++) 
      { 
        if ($counter == $page) 
          $pagination.= "<span class=\"current\">$counter</span>"; 
        else 
          $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
      } 
    } 
    elseif($lastpage > 5 + ($adjacents * 2))  //enough pages to hide some 
    { 
      //close to beginning; only hide later pages 
      if($page < 1 + ($adjacents * 2))     
      { 
        for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) 
        { 
          if ($counter == $page) 
            $pagination.= "<span class=\"current\">$counter</span>"; 
          else 
            $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
        } 
        $pagination.= "..."; 
        $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>"; 
        $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";     
      } 
      //in middle; hide some front and some back 
      elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) 
      { 
        $pagination.= "<a href=\"$targetpage"."page=1\">1</a>"; 
        $pagination.= "<a href=\"$targetpage"."page=2\">2</a>"; 
        $pagination.= "..."; 
        for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) 
        { 
          if ($counter == $page) 
            $pagination.= "<span class=\"current\">$counter</span>"; 
          else 
            $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
        } 
        $pagination.= "..."; 
        $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>"; 
        $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";     
      } 
      //close to end; only hide early pages 
      else 
      { 
        $pagination.= "<a href=\"$targetpage"."page=1\">1</a>"; 
        $pagination.= "<a href=\"$targetpage"."page=2\">2</a>"; 
        $pagination.= "..."; 
        for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) 
        { 
          if ($counter == $page) 
            $pagination.= "<span class=\"current\">$counter</span>"; 
          else 
            $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
        } 
      } 
    } 
     
    //next button 
    if ($page < $counter - 1) 
      $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>"; 
    else 
      $pagination.= "<span class=\"disabled\"> next »</span>"; 
    $pagination.= "</div>\n";     
  } 
    
    echo '<div id="ad-wrapper">'; 
    if($total_pages==0) echo "No Results for ".$char."!";
    else{
      $c = -1;
      while($row = mysql_fetch_array($result)) 
      { 
        if($c%$rows==$rows-1) echo "<br/>";
        echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
        $c++;
        $c++;
      } 
    }
}

echo $pagination;

?> 
  1. <?php
  2.  
  3. // How many adjacent pages should be shown on each side? 
  4. $adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list) 
  5. //how many items to show per page 
  6. $limit = 10; 
  7. //Number of ads per row
  8. $rows = 3;
  9. //This creates the menu at the top A-Z 
  10. $char = $_GET['letter']; 
  11. $list="num";
  12.     
  13. if(!empty($char)){
  14.   include('connect.php'); 
  15.   $tbl_name="amp_ads";    //your table name 
  16.    
  17.   /* 
  18.     First get total number of rows in data table. 
  19.     If you have a WHERE clause in your query, make sure you mirror it here. 
  20.   */ 
  21.   if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name"; 
  22.   elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'"; 
  23.   else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'"; 
  24.   $total_pages = mysql_fetch_array(mysql_query($query)); 
  25.   $total_pages = $total_pages[num]; 
  26.    
  27.   /* Setup vars for query. */ 
  28.   if(!empty($char)) $targetpage = $_SERVER['PHP_SELF'] . "?letter=$char&"; 
  29.   else $targetpage = "az.php?";   //your file name (the name of this file) 
  30.   $page = $_GET['page']; 
  31.   if($page) 
  32.     $start = ($page - 1) * $limit;       //first item to display on this page 
  33.   else 
  34.     $start = 0;                //if no page var is given, set start to 0 
  35.    
  36.   /* Get data. */ 
  37.   if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit"; 
  38.   elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit"; 
  39.   else $sql = "SELECT * FROM $tbl_name WHERE title LIKE '$char%' LIMIT $start, $limit"; 
  40.   $result = mysql_query($sql); 
  41.    
  42.   /* Setup page vars for display. */ 
  43.   if ($page == 0) $page = 1;          //if no page var is given, default to 1. 
  44.   $prev = $page - 1;              //previous page is page - 1 
  45.   $next = $page + 1;              //next page is page + 1 
  46.   $lastpage = ceil($total_pages/$limit);    //lastpage is = total pages / items per page, rounded up. 
  47.   $lpm1 = $lastpage - 1;            //last page minus 1 
  48.    
  49.   /* 
  50.     Now we apply our rules and draw the pagination object. 
  51.     We're actually saving the code to a variable in case we want to draw it more than once. 
  52.   */ 
  53.   $pagination = ""; 
  54.   if($lastpage > 1) 
  55.   {   
  56.     $pagination .= "<div class=\"pagination\">"; 
  57.     //previous button 
  58.     if ($page > 1) 
  59.       $pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>"; 
  60.     else 
  61.       $pagination.= "<span class=\"disabled\">« previous </span>";   
  62.      
  63.     //pages   
  64.     if ($lastpage < 7 + ($adjacents * 2))  //not enough pages to bother breaking it up 
  65.     {   
  66.       for ($counter = 1; $counter <= $lastpage; $counter++) 
  67.       { 
  68.         if ($counter == $page) 
  69.           $pagination.= "<span class=\"current\">$counter</span>"; 
  70.         else 
  71.           $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
  72.       } 
  73.     } 
  74.     elseif($lastpage > 5 + ($adjacents * 2))  //enough pages to hide some 
  75.     { 
  76.       //close to beginning; only hide later pages 
  77.       if($page < 1 + ($adjacents * 2))     
  78.       { 
  79.         for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) 
  80.         { 
  81.           if ($counter == $page) 
  82.             $pagination.= "<span class=\"current\">$counter</span>"; 
  83.           else 
  84.             $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
  85.         } 
  86.         $pagination.= "..."; 
  87.         $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>"; 
  88.         $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";     
  89.       } 
  90.       //in middle; hide some front and some back 
  91.       elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) 
  92.       { 
  93.         $pagination.= "<a href=\"$targetpage"."page=1\">1</a>"; 
  94.         $pagination.= "<a href=\"$targetpage"."page=2\">2</a>"; 
  95.         $pagination.= "..."; 
  96.         for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) 
  97.         { 
  98.           if ($counter == $page) 
  99.             $pagination.= "<span class=\"current\">$counter</span>"; 
  100.           else 
  101.             $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
  102.         } 
  103.         $pagination.= "..."; 
  104.         $pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>"; 
  105.         $pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";     
  106.       } 
  107.       //close to end; only hide early pages 
  108.       else 
  109.       { 
  110.         $pagination.= "<a href=\"$targetpage"."page=1\">1</a>"; 
  111.         $pagination.= "<a href=\"$targetpage"."page=2\">2</a>"; 
  112.         $pagination.= "..."; 
  113.         for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) 
  114.         { 
  115.           if ($counter == $page) 
  116.             $pagination.= "<span class=\"current\">$counter</span>"; 
  117.           else 
  118.             $pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";           
  119.         } 
  120.       } 
  121.     } 
  122.      
  123.     //next button 
  124.     if ($page < $counter - 1) 
  125.       $pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>"; 
  126.     else 
  127.       $pagination.= "<span class=\"disabled\"> next »</span>"; 
  128.     $pagination.= "</div>\n";     
  129.   } 
  130.     
  131.     echo '<div id="ad-wrapper">'; 
  132.     if($total_pages==0) echo "No Results for ".$char."!";
  133.     else{
  134.       $c = -1;
  135.       while($row = mysql_fetch_array($result)) 
  136.       { 
  137.         if($c%$rows==$rows-1) echo "<br/>";
  138.         echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
  139.         $c++;
  140.         $c++;
  141.       } 
  142.     }
  143. }
  144. echo $pagination;
  145. ?> 


AZ.php
Code: [ Select ]
<div id="aznavbar" class="drop-shadow raised">
<?php 
  //This creates the menu at the top A-Z 
  $char = $_GET['letter']; 
  $list="num"; 
  foreach (range('A', 'Z') as $i) $list.=",$i"; 
  $list.=",Show All Ads"; 
  $a = explode(',', $list); 
  foreach ($a as $b) { 
    if (!empty($b)) { 
      if ($b=="num") { 
        if ($char=="num") echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=num\">#</a>"; 
        else echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=num\">#</a>"; 
      } 
      elseif ($b=="Show All Ads") { 
        if (($char=="*")||(empty($char))) echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=*\">Show All Ads</a>"; 
        else echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=*\">Show All Ads</a>"; 
      } 
      elseif($b==$char) echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=".$b."\">$b</a>"; 
      else echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=".$b."\">$b</a>"; 
    } 
  } 
?> 
</div>
  1. <div id="aznavbar" class="drop-shadow raised">
  2. <?php 
  3.   //This creates the menu at the top A-Z 
  4.   $char = $_GET['letter']; 
  5.   $list="num"; 
  6.   foreach (range('A', 'Z') as $i) $list.=",$i"; 
  7.   $list.=",Show All Ads"; 
  8.   $a = explode(',', $list); 
  9.   foreach ($a as $b) { 
  10.     if (!empty($b)) { 
  11.       if ($b=="num") { 
  12.         if ($char=="num") echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=num\">#</a>"; 
  13.         else echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=num\">#</a>"; 
  14.       } 
  15.       elseif ($b=="Show All Ads") { 
  16.         if (($char=="*")||(empty($char))) echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=*\">Show All Ads</a>"; 
  17.         else echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=*\">Show All Ads</a>"; 
  18.       } 
  19.       elseif($b==$char) echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=".$b."\">$b</a>"; 
  20.       else echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=".$b."\">$b</a>"; 
  21.     } 
  22.   } 
  23. ?> 
  24. </div>


index.php
Code: [ Select ]
<html>
<head> <title> </title>
<meta name="viewport" content="initial-scale=1.0">

<link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
<style media="screen" type="text/css"> 

html, body { }

#aznavbar a:link { 
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px; 
text-decoration:none; 

 
#aznavbar a:visited { 
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px; 
text-decoration:none; 



#aznavbar a:hover {
background-color: #FA6405;
color:#000; 
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px; 
text-decoration:none; 



#aznavbar a:active{ 
color:#FA6405; 
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px; 
text-decoration:none; 
}

#aznavbar { 
 background: #141414;
 background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
 background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
 background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
 background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
 background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
 background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
 filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
 border: 1px solid #000; 
 margin: -10px 0px 0px -8px;
 padding: 10 0px 10px 80px;
 width: 94.8%;
 } 

a:hover#showall { 


#ad-wrapper{ 
  margin:0px auto 0px auto; 
  text-align:center; 
}

</style> 
</head>

<body>

<?php include('az.php'); ?>

<div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>

<div id="login">Login:&nbsp;<input type="username" class="login" size="20px;">
<br />
Password:&nbsp;<input class="login" type="password" size="20px">
<br />
Remember Me? <input type="checkbox">

<a href="#">Register Now For Free!</a>

<div class="note orange rounded">Start your Advertising or Publishing Campaign Now by simply clicking the Register Now button above!</div></div>

<div name="target" id="target"><?php include 'results.php'; ?></div>

</body>
</html>
  1. <html>
  2. <head> <title> </title>
  3. <meta name="viewport" content="initial-scale=1.0">
  4. <link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
  5. <link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
  6. <link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
  7. <style media="screen" type="text/css"> 
  8. html, body { }
  9. #aznavbar a:link { 
  10. color: #0C7FB0;
  11. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  12. margin-left: 4.15px;
  13. padding: 10px; 
  14. text-decoration:none; 
  15.  
  16. #aznavbar a:visited { 
  17. color: #0C7FB0;
  18. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  19. padding: 10px; 
  20. text-decoration:none; 
  21. #aznavbar a:hover {
  22. background-color: #FA6405;
  23. color:#000; 
  24. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  25. padding: 10px; 
  26. text-decoration:none; 
  27. #aznavbar a:active{ 
  28. color:#FA6405; 
  29. font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
  30. padding: 10px; 
  31. text-decoration:none; 
  32. }
  33. #aznavbar { 
  34.  background: #141414;
  35.  background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
  36.  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
  37.  background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
  38.  background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
  39.  background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
  40.  background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
  41.  filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
  42.  border: 1px solid #000; 
  43.  margin: -10px 0px 0px -8px;
  44.  padding: 10 0px 10px 80px;
  45.  width: 94.8%;
  46.  } 
  47. a:hover#showall { 
  48. #ad-wrapper{ 
  49.   margin:0px auto 0px auto; 
  50.   text-align:center; 
  51. }
  52. </style> 
  53. </head>
  54. <body>
  55. <?php include('az.php'); ?>
  56. <div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
  57. <div id="login">Login:&nbsp;<input type="username" class="login" size="20px;">
  58. <br />
  59. Password:&nbsp;<input class="login" type="password" size="20px">
  60. <br />
  61. Remember Me? <input type="checkbox">
  62. <a href="#">Register Now For Free!</a>
  63. <div class="note orange rounded">Start your Advertising or Publishing Campaign Now by simply clicking the Register Now button above!</div></div>
  64. <div name="target" id="target"><?php include 'results.php'; ?></div>
  65. </body>
  66. </html>


EDIT:: j'ai tapé plus lentement que je pensais tout à l'heure donc j'ai corrigé ce que je disais au sommet ainsi que les balises de code que j'ai foiré. Il s'agit d'un exemple de travail moins les trucs de Mysql. Ceci rechargera le tape pas page cependant pouvoir charger le contenu dans la cible div.
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Inscription: Jan 06, 2006
  • Messages: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Message Janvier 2nd, 2013, 11:37 am

Salut Scott,

Merci beaucoup! C'est exactement ce que je voulais accomplir !

-Brian
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Inscription: Juil 06, 2010
  • Messages: 260
  • Status: Offline

Message Janvier 2nd, 2013, 11:41 am

Pas de problème
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Inscription: Jan 06, 2006
  • Messages: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Message Janvier 2nd, 2013, 9:17 pm

J'espère que je ne suis pas trop tard...

J'ai besoin de générer les résultats dans plusieurs colonnes, quelque chose comme un type de variable : cols $ = 4 permettra aux 4 enregistrements à afficher sur la page, puis fractionne automatiquement à la ligne suivante. À l'heure actuelle, la sortie affiche les annonces dans une seule colonne (plusieurs lignes vers le bas de la page).

Je vous remercie à l'avance Scott !
Brian
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Inscription: Juil 06, 2010
  • Messages: 260
  • Status: Offline

Message Janvier 3rd, 2013, 8:13 am

OK, un couple de choses Ive trouvé.

Première le lorsque vous générez les liens (en bas de la page results.php). Dans le tout en boucle le lien Isnt est-elle interrompue avec une &lt;/a&gt; tag également entre l'image et le texte, il est un random &lt;p/&gt; . Dans le test, j'ai mis ensemble, j'ai sorti la &lt;p/&gt; et ajouté un &lt;/a&gt; à la fin du texte.

Cela est arrivé à faire le genre de script de travail la prochaine chose que j'ai remarqué était (également dans le temps boucle en bas) vous avez eu un c ++; suivie d'une autre c ++; qui était de jouer avec votre variable de lignes $. Souscrire à une de ces variables est que votre script fonctionne correctement.

Voir le texte cité à la référence

Quote:
tandis que ($ row = mysql_fetch_array($result))
{
if($c%$Rows==$Rows-1) echo "&lt;br/&gt;" ;
echo "&lt; un href=\"details.php?id=$row[n] \ "&gt;&lt; classe img = \"ads\"alt = \"$ row [alt] \"title = \"$ row [alt] \"src = \"$ row [bannière] \"&gt;&lt; p / &gt; $row [alt]";
$c++;
$c++;
}


Voici une modification tout en boucle qui devrait fonctionner pour vous
PHP Code: [ Select ]
while($row = mysql_fetch_array($result))
            {  
                if($c%$rows==$rows-1) echo "<br/>";
                echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"> $row[alt]</a>";
                $c++;
            }
 
  1. while($row = mysql_fetch_array($result))
  2.             {  
  3.                 if($c%$rows==$rows-1) echo "<br/>";
  4.                 echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"> $row[alt]</a>";
  5.                 $c++;
  6.             }
  7.  


Je vais joindre les infos de test que j'ai aussi bien. Avertissement utilisant ça ne vous aidera pas que je force les informations de la base de données fausses, de me donner des résultats, je suis lui comme un matériau de référence seulement. Cela vous donnera une idée si les changements qui en résultent sont l'effet désiré.
Attachments:
test.zip

(193.52 Kio) Téléchargé 17 fois

  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Janvier 3rd, 2013, 8:13 am

Afficher de l'information

  • Total des messages de ce sujet: 18 messages
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 225 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC