Alphanav ayuda necesaria

  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Registrado: Ene 06, 2006
  • Mensajes: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Nota Diciembre 31st, 2012, 6:27 pm

Hola todos y feliz año nuevo!

Tengo algún código de php de trabajo que muestra un índice de navegación alfabético a-z en la parte superior de mi página web, su diseño intented es abrir en una ventana nueva, pero ahora quiero que abra en la misma página...he encontrado un iframe o "interruptor" debería funcionar bien, pero aparentemente no puedo hacerlo funcionar bien.

Aquí está lo que quiero decir, una dirección url para mostrar el tema:http://reunitemysite.com/test2/login.php

Al hacer clic en cualquiera de los enlaces en el alphanav superior, la muestra de enlace el css como el mysql query provocar el iframe de destino, todo lo que quiero mostrar en el iframe es resultado de la consulta de mySQL, no el css de barra de alphanav propio.

index.php
Código: [ 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>


Código: [ 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>


Nota: Las dos páginas php anteriores funcionan bien excepto por el hecho de que los enlaces en el primer bloque de código, que es la naviation del alfabeto de php incluido (incluye az.php) el segundo bloque de código es donde el bloque de código debe ser modificado--justo bajo la etiqueta de cuerpo en el segundo bloque de código, pero estoy desorientado sobre lo que necesita ser cambiado.

Llevo esperando tanto tiempo para una solución a esto, no me gusta decir cuánto tiempo...:oops:

Gracias de antemano!
Brian
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Diciembre 31st, 2012, 6:27 pm

  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Registrado: Jul 06, 2010
  • Mensajes: 266
  • Status: Online

Nota Enero 2nd, 2013, 7:36 am

¿necesita deshacerse de la "apertura de una nueva página" todos juntos? Si es así en el código que crea los vínculos quitar al parámetro de destino. A continuación está el código proporcionado sin el parámetro target. No probado

index.php
PHP Código: [ 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.  



y suponiendo que Im az.php
PHP Código: [ 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
  • Registrado: Ene 06, 2006
  • Mensajes: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Nota Enero 2nd, 2013, 8:35 am

Código sigue lo mismo...he puesto el destino = "marco" en la página de az.php en los enlaces situados en esta área:

Quote:
//This crea el menú en la parte superior A-Z


y cuando hago clic en los vínculos de la barra de az, todavía estoy recibiendo la parte de css ( #, a-z, mostrar todos los enlaces) en el iframe, no quiero que, sólo el MySQL resultados parte...

I * pensar * (a menos que me más pensando en todo esto) la parte que crea el menú de az (enlaces) en la página de az.php debe ser eliminado y que necesitaría crear una nueva barra (básicamente en html y css, no php) en la página index.php, pero el resto del código en la az.php tendría que ser actualizado para reflejar los cambios.

Espero que entienda!
Gracias de nuevo!
Brian
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Registrado: Jul 06, 2010
  • Mensajes: 266
  • Status: Online

Nota Enero 2nd, 2013, 9:08 am

Tal vez no entiendo lo que tu tratando de lograr. Corrí el código que puse en mi post anterior y además de los errores de mysql (ya no tengo esa parte del código) abrió la az.php en la misma ventana como índice (interruptor de página total).


¿Se intenta apuntar sólo el iframe con la navegación y cargar sólo los resultados en el iframe?
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Registrado: Jul 06, 2010
  • Mensajes: 266
  • Status: Online

Nota Enero 2nd, 2013, 9:28 am

Si ese es el caso sin embargo usando la misma página para hacer el resultado establezca y la navegación va a darle un dolor de cabeza. Les divide en dos archivos diferentes.

index.php
PHP Código: [ 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 Código: [ 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 Código: [ 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
  • Registrado: Ene 06, 2006
  • Mensajes: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Nota Enero 2nd, 2013, 10:02 am

Hola Scott,

Funciona!!

Gracias, si puedo ofrecerle unos cuantos dólares por paypal, enviarme un mensaje.

Gracias de nuevo,
y feliz año nuevo!

-Brian
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Registrado: Jul 06, 2010
  • Mensajes: 266
  • Status: Online

Nota Enero 2nd, 2013, 10:07 am

Ninguna necesidad . Estoy encantado de ayuda y tengan un feliz año nuevo.
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Registrado: Ene 06, 2006
  • Mensajes: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Nota Enero 2nd, 2013, 11:03 am

Hola Scott,

¿Odio a molestarte, y no * creo * su gran de una relación, pero en lugar de apertura en iframe, me pueden ayudar abrir en la div de php "interruptor"? Razón: La altura del iframe, creo que ustedes saben el resto...les gusta utilizar javascript para algo así.:|

Heres un poco de código de "cambio" que funciona:

Código: [ 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
  • Registrado: Jul 06, 2010
  • Mensajes: 266
  • Status: Online

Nota Enero 2nd, 2013, 11:12 am

Usted debe ser capaz de cambiar el results.php a esto

PHP Código: [ 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.  


y apenas se incluye en la etiqueta div

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


Si Im no equivocado los resultados página devuelve nothing si las variables no están configurados.
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Registrado: Ene 06, 2006
  • Mensajes: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Nota Enero 2nd, 2013, 11:23 am

Que probé y abren los resultados en la pare no ventana (no nuevo)...estoy intentando para el &lt; div id = "destino" &gt;&lt; / div &gt;

¿Otra oportunidad?
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Registrado: Jul 06, 2010
  • Mensajes: 266
  • Status: Online

Nota Enero 2nd, 2013, 11:30 am

Lo siento envié que fuera me olvidé de agregar algunas cosas

Echaba de menos algo en la results.php
Código: [ 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
Código: [ 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
Código: [ 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>


EDICIÓN:: escribí más lento de lo que estaba pensando ahora mismo por lo que me fijo lo que estaba diciendo en la parte superior, así como las etiquetas de código que meti. Este es un ejemplo de trabajo menos cosas de Mysql. Esto provocará que recargue la pare no página sin embargo cargará el contenido en el div de destino.
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Registrado: Ene 06, 2006
  • Mensajes: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Nota Enero 2nd, 2013, 11:37 am

Hola Scott,

¡Muchas gracias! Eso es exactamente lo que intentaba lograr!

-Brian
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Registrado: Jul 06, 2010
  • Mensajes: 266
  • Status: Online

Nota Enero 2nd, 2013, 11:41 am

No hay problema
  • Brian Jester
  • Beginner
  • Beginner
  • No Avatar
  • Registrado: Ene 06, 2006
  • Mensajes: 61
  • Loc: Bayonne, New Jersey USA
  • Status: Offline

Nota Enero 2nd, 2013, 9:17 pm

Espero que no estoy demasiado tarde...

Necesito los resultados en varias columnas, algo así como un como variable de salida: $columnas = 4 permitirá 4 registros mostrar en la página y, a continuación, automáticamente se rompe a la fila siguiente. Tal y como está ahora, la salida muestra anuncios en una sola columna (varias filas hacia abajo de la página).

Gracias de antemano Scott!
Brian
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Registrado: Jul 06, 2010
  • Mensajes: 266
  • Status: Online

Nota Enero 3rd, 2013, 8:13 am

OK Ive encontró un par de cosas.

Primera cuando construyes los enlaces (parte inferior de la página de results.php). Mientras el vínculo de bucle Isnt cerrada con un &lt;/a&gt; etiqueta también entre la imagen y el texto que es un azar &lt;p/&gt; . Así en la prueba de que poner juntos saqué la &lt;p/&gt; y un &lt;/a&gt; hasta el final del texto.

Esto sucedió para que el tipo de secuencia de comandos de trabajo la próxima cosa que noté fue (también en el tiempo lazo en la parte inferior) había un c ++; seguido de otro c ++; que fue jugar con la variable de filas $. Sacar una de estas variables hará que su script funcione correctamente.

Véase el texto citado por referencia

Quote:
mientras ($ 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; clase de img = \"ads\"alt = \"$ fila [alt] \"título = \"$ fila [alt] \"src = \"$ fila [banner] \"&gt;&lt; p / &gt; $fila [alt]";
$c++;
$c++;
}


Aquí es una alteración al bucle que debe trabajar para usted
PHP Código: [ 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.  


Voy a adjuntar la información de prueba que tengo así. ADVERTENCIA usando esto no le ayudará como fuerza a información de la base de datos falsos darme resultados les proporciono como material de referencia sólo. Esto le dará una idea si los cambios resultantes son el efecto deseado.
Attachments:
test.zip

(193.52 KiB) 19 veces

  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Enero 3rd, 2013, 8:13 am

Publicar Información

  • Total de mensajes en este tema: 18 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 148 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC