Alphanav Help Needed...
- Brian Jester
- Beginner


- Joined: Jan 06, 2006
- Posts: 61
- Loc: Bayonne, New Jersey USA
- Status: Offline
Hi Everyone, and happy new year!
I have some working php code that displays an alphabetical navigation A-z index across the top of my website, but it's intented design is to open in a new window, but now I want it to open within the same page...I have found either an iframe or 'switch' would work fine, but I can't seem to get it working right.
Here's what I mean, a url to display the issue: http://reunitemysite.com/test2/login.php
When you click on any of the links in the top alphanav, the link displays the css as well as the mysql query result in the targeted iframe, all I want to display in the iframe is the mySQL query result, not the alphanav bar css itself.
index.php
Note: The two php pages above work fine except for the fact that the links in the first block of code, which is the included php alphabet naviation (include az.php) the second block of code is where the code block needs to be modified -- right under the body tag in the second block of code, but I am clueless as to what needs to be changed.
I have been waiting so long for a fix to this, I hate to tell how long...
Thank you in advance!
Brian
I have some working php code that displays an alphabetical navigation A-z index across the top of my website, but it's intented design is to open in a new window, but now I want it to open within the same page...I have found either an iframe or 'switch' would work fine, but I can't seem to get it working right.
Here's what I mean, a url to display the issue: http://reunitemysite.com/test2/login.php
When you click on any of the links in the top alphanav, the link displays the css as well as the mysql query result in the targeted iframe, all I want to display in the iframe is the mySQL query result, not the alphanav bar css itself.
index.php
Code: [ Select ]
<html>
<head> <title> </title>
<meta name="viewport" content="initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
</head>
<body>
<?php include('az.php'); ?>
<div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
<div id="login">Login: <input type="username" class="login" size="20px;">
<br />
Password: <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>
<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: <input type="username" class="login" size="20px;">
<br />
Password: <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>
- <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: <input type="username" class="login" size="20px;">
- <br />
- Password: <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>
Code: [ Select ]
<?php
// How many adjacent pages should be shown on each side?
$adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)
//how many items to show per page
$limit = 10;
//Number of ads per row
$rows = 3;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>A To Z AD Navigation </title>
<style media="screen" type="text/css">
html, body { }
#aznavbar a:link {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px;
text-decoration:none;
}
#aznavbar a:visited {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:hover {
background-color: #FA6405;
color:#000;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:active{
color:#FA6405;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar {
background: #141414;
background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
border: 1px solid #000;
margin: -10px 0px 0px -8px;
padding: 10 0px 10px 80px;
width: 94.8%;
}
a:hover#showall {
}
#ad-wrapper{
margin:0px auto 0px auto;
text-align:center;
}
</style>
</head>
<body>
<div id="aznavbar" class="drop-shadow raised">
<?php
//This creates the menu at the top A-Z
$char = $_GET['letter'];
$list="num";
foreach (range('A', 'Z') as $i) $list.=",$i";
$list.=",Show All Ads";
$a = explode(',', $list);
foreach ($a as $b) {
if (!empty($b)) {
if ($b=="num") {
if ($char=="num") echo "<a href=\"az.php?letter=num\" target=\"frame\">#</a>";
else echo "<a href=\"az.php?letter=num\" target=\"frame\">#</a>";
}
elseif ($b=="Show All Ads") {
if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\" target=\"frame\">Show All Ads</a>";
else echo "<a href=\"az.php?letter=*\" target=\"frame\">Show All Ads</a>";
}
elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\" target=\"frame\">$b</a>";
else echo "<a href=\"az.php?letter=".$b."\" target=\"frame\">$b</a>";
}
}
?>
</div>
<?php
if(!empty($char)){
include('connect.php');
$tbl_name="amp_ads"; //your table name
/*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";
elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";
else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
/* Setup vars for query. */
if(!empty($char)) $targetpage = "az.php?letter=$char&";
else $targetpage = "az.php?"; //your file name (the name of this file)
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0
/* Get data. */
if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";
elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";
else $sql = "SELECT * FROM $tbl_name WHERE title LIKE '$char%' LIMIT $start, $limit";
$result = mysql_query($sql);
/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var is given, default to 1.
$prev = $page - 1; //previous page is page - 1
$next = $page + 1; //next page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last page minus 1
/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
{
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";
else
$pagination.= "<span class=\"disabled\">« previous </span>";
//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
}
//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";
else
$pagination.= "<span class=\"disabled\"> next »</span>";
$pagination.= "</div>\n";
}
?>
<?php
echo '<div id="ad-wrapper">';
if($total_pages==0) echo "No Results for ".$char."!";
else{
$c = -1;
while($row = mysql_fetch_array($result))
{
if($c%$rows==$rows-1) echo "<br/>";
echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
$c++;
$c++;
}
}
}
?>
<?php echo $pagination ?>
</div></body>
</html>
// 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>
- <?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>
Note: The two php pages above work fine except for the fact that the links in the first block of code, which is the included php alphabet naviation (include az.php) the second block of code is where the code block needs to be modified -- right under the body tag in the second block of code, but I am clueless as to what needs to be changed.
I have been waiting so long for a fix to this, I hate to tell how long...
Thank you in advance!
Brian
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
December 31st, 2012, 6:27 pm
- ScottG
- Proficient


- Joined: Jul 06, 2010
- Posts: 260
- Status: Offline
do you need to get rid of the "opening in a new page" all together? if so in the code that builds the links remove to target parameter. Below is the code you provided without the target parameter. UNTESTED
index.php
and I'm assuming az.php
index.php
PHP Code: [ Select ]
<html>
<head> <title> </title>
<meta name="viewport" content="initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
</head>
<body>
<?php include('az.php'); ?>
<div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
<div id="login">Login: <input type="username" class="login" size="20px;">
<br />
Password: <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>
<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: <input type="username" class="login" size="20px;">
<br />
Password: <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>
- <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: <input type="username" class="login" size="20px;">
- <br />
- Password: <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>
and I'm assuming az.php
PHP Code: [ Select ]
<?php
// How many adjacent pages should be shown on each side?
$adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)
//how many items to show per page
$limit = 10;
//Number of ads per row
$rows = 3;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>A To Z AD Navigation </title>
<style media="screen" type="text/css">
html, body { }
#aznavbar a:link {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px;
text-decoration:none;
}
#aznavbar a:visited {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:hover {
background-color: #FA6405;
color:#000;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:active{
color:#FA6405;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar {
background: #141414;
background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
border: 1px solid #000;
margin: -10px 0px 0px -8px;
padding: 10 0px 10px 80px;
width: 94.8%;
}
a:hover#showall {
}
#ad-wrapper{
margin:0px auto 0px auto;
text-align:center;
}
</style>
</head>
<body>
<div id="aznavbar" class="drop-shadow raised">
<?php
//This creates the menu at the top A-Z
$char = $_GET['letter'];
$list="num";
foreach (range('A', 'Z') as $i) $list.=",$i";
$list.=",Show All Ads";
$a = explode(',', $list);
foreach ($a as $b) {
if (!empty($b)) {
if ($b=="num") {
if ($char=="num") echo "<a href=\"az.php?letter=num\">#</a>";
else echo "<a href=\"az.php?letter=num\">#</a>";
}
elseif ($b=="Show All Ads") {
if (($char=="*")||(empty($char))) echo "<a href=\"az.php?letter=*\">Show All Ads</a>";
else echo "<a href=\"az.php?letter=*\">Show All Ads</a>";
}
elseif($b==$char) echo "<a href=\"az.php?letter=".$b."\">$b</a>";
else echo "<a href=\"az.php?letter=".$b."\">$b</a>";
}
}
?>
</div>
<?php
if(!empty($char)){
include('connect.php');
$tbl_name="amp_ads"; //your table name
/*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";
elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";
else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
/* Setup vars for query. */
if(!empty($char)) $targetpage = "az.php?letter=$char&";
else $targetpage = "az.php?"; //your file name (the name of this file)
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0
/* Get data. */
if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";
elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";
else $sql = "SELECT * FROM $tbl_name WHERE title LIKE '$char%' LIMIT $start, $limit";
$result = mysql_query($sql);
/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var is given, default to 1.
$prev = $page - 1; //previous page is page - 1
$next = $page + 1; //next page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last page minus 1
/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
{
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";
else
$pagination.= "<span class=\"disabled\">« previous </span>";
//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
}
//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";
else
$pagination.= "<span class=\"disabled\"> next »</span>";
$pagination.= "</div>\n";
}
?>
<?php
echo '<div id="ad-wrapper">';
if($total_pages==0) echo "No Results for ".$char."!";
else{
$c = -1;
while($row = mysql_fetch_array($result))
{
if($c%$rows==$rows-1) echo "<br/>";
echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
$c++;
$c++;
}
}
}
?>
<?php echo $pagination ?>
</div></body>
</html>
// 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>
- <?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>
- Brian Jester
- Beginner


- Joined: Jan 06, 2006
- Posts: 61
- Loc: Bayonne, New Jersey USA
- Status: Offline
Code still does the same thing...I have put the target="frame" part into the az.php page in the links located in this area:
and when I click on the links in the az navbar, I am still getting the css part (#, a-z, show all links) in the iframe, I don't want that, JUST the MySQL results part...
I *think* (unless I am over thinking this whole thing) the part that creates the az menu (links) in the az.php page needs to be removed, and I would need to create a whole new navbar (basically in html and css, no php) in the index.php page, but the rest of the code in the az.php would need to be updated to reflect those changes.
Hope you understand!
Thanks again!
Brian
Quote:
//This creates the menu at the top A-Z
and when I click on the links in the az navbar, I am still getting the css part (#, a-z, show all links) in the iframe, I don't want that, JUST the MySQL results part...
I *think* (unless I am over thinking this whole thing) the part that creates the az menu (links) in the az.php page needs to be removed, and I would need to create a whole new navbar (basically in html and css, no php) in the index.php page, but the rest of the code in the az.php would need to be updated to reflect those changes.
Hope you understand!
Thanks again!
Brian
- ScottG
- Proficient


- Joined: Jul 06, 2010
- Posts: 260
- Status: Offline
Maybe i don't understand what your trying to accomplish. i ran the code i put in my last post and besides the mysql errors (since i don't have that part of the code) it opened the az.php in the same window as index (total page switch).
Are you trying to target just the iframe with the navigation and load just the results into the iframe?
Are you trying to target just the iframe with the navigation and load just the results into the iframe?
- ScottG
- Proficient


- Joined: Jul 06, 2010
- Posts: 260
- Status: Offline
If that is the case however using the same page to do the result set and the navigation is going to give you a headache. Split them up into two different files.
index.php
az.php
results.php
index.php
PHP Code: [ Select ]
<html>
<head> <title> </title>
<meta name="viewport" content="initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
<style media="screen" type="text/css">
html, body { }
#aznavbar a:link {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px;
text-decoration:none;
}
#aznavbar a:visited {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:hover {
background-color: #FA6405;
color:#000;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:active{
color:#FA6405;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar {
background: #141414;
background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
border: 1px solid #000;
margin: -10px 0px 0px -8px;
padding: 10 0px 10px 80px;
width: 94.8%;
}
a:hover#showall {
}
#ad-wrapper{
margin:0px auto 0px auto;
text-align:center;
}
</style>
</head>
<body>
<?php include('az.php'); ?>
<div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
<div id="login">Login: <input type="username" class="login" size="20px;">
<br />
Password: <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>
<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: <input type="username" class="login" size="20px;">
<br />
Password: <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>
- <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: <input type="username" class="login" size="20px;">
- <br />
- Password: <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>
az.php
PHP Code: [ Select ]
<div id="aznavbar" class="drop-shadow raised">
<?php
//This creates the menu at the top A-Z
$char = $_GET['letter'];
$list="num";
foreach (range('A', 'Z') as $i) $list.=",$i";
$list.=",Show All Ads";
$a = explode(',', $list);
foreach ($a as $b) {
if (!empty($b)) {
if ($b=="num") {
if ($char=="num") echo "<a href=\"results.php?letter=num\" target=\"frame\">#</a>";
else echo "<a href=\"results.php?letter=num\" target=\"frame\">#</a>";
}
elseif ($b=="Show All Ads") {
if (($char=="*")||(empty($char))) echo "<a href=\"results.php?letter=*\" target=\"frame\">Show All Ads</a>";
else echo "<a href=\"results.php?letter=*\" target=\"frame\">Show All Ads</a>";
}
elseif($b==$char) echo "<a href=\"results.php?letter=".$b."\" target=\"frame\">$b</a>";
else echo "<a href=\"results.php?letter=".$b."\" target=\"frame\">$b</a>";
}
}
?>
</div>
<?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>
- <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>
results.php
PHP Code: [ Select ]
<?php
// How many adjacent pages should be shown on each side?
$adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)
//how many items to show per page
$limit = 10;
//Number of ads per row
$rows = 3;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>A To Z AD Navigation </title>
<style media="screen" type="text/css">
html, body { }
#aznavbar a:link {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px;
text-decoration:none;
}
#aznavbar a:visited {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:hover {
background-color: #FA6405;
color:#000;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:active{
color:#FA6405;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar {
background: #141414;
background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
border: 1px solid #000;
margin: -10px 0px 0px -8px;
padding: 10 0px 10px 80px;
width: 94.8%;
}
a:hover#showall {
}
#ad-wrapper{
margin:0px auto 0px auto;
text-align:center;
}
</style>
</head>
<body>
<?php
//This creates the menu at the top A-Z
$char = $_GET['letter'];
$list="num";
if(!empty($char)){
include('connect.php');
$tbl_name="amp_ads"; //your table name
/*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";
elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";
else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
/* Setup vars for query. */
if(!empty($char)) $targetpage = "results.php?letter=$char&";
else $targetpage = "az.php?"; //your file name (the name of this file)
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0
/* Get data. */
if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";
elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";
else $sql = "SELECT * FROM $tbl_name WHERE title LIKE '$char%' LIMIT $start, $limit";
$result = mysql_query($sql);
/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var is given, default to 1.
$prev = $page - 1; //previous page is page - 1
$next = $page + 1; //next page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last page minus 1
/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
{
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";
else
$pagination.= "<span class=\"disabled\">« previous </span>";
//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
}
//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";
else
$pagination.= "<span class=\"disabled\"> next »</span>";
$pagination.= "</div>\n";
}
?>
<?php
echo '<div id="ad-wrapper">';
if($total_pages==0) echo "No Results for ".$char."!";
else{
$c = -1;
while($row = mysql_fetch_array($result))
{
if($c%$rows==$rows-1) echo "<br/>";
echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
$c++;
$c++;
}
}
}
?>
<?php echo $pagination ?>
</body>
</html>
// 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>
- <?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>
- Brian Jester
- Beginner


- Joined: Jan 06, 2006
- Posts: 61
- Loc: Bayonne, New Jersey USA
- Status: Offline
- ScottG
- Proficient


- Joined: Jul 06, 2010
- Posts: 260
- Status: Offline
- Brian Jester
- Beginner


- Joined: Jan 06, 2006
- Posts: 61
- Loc: Bayonne, New Jersey USA
- Status: Offline
Hi Scott,
Hate to bother you, and I don't *think* it's that big of a deal to do, but instead of opening into iframe, can you help me open it into the php 'switch' div? Reason: The height of the iframe, I think you know the rest...Don't like to use javascript for something like that.
Here's a bit of 'switch' code that works:
<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>
Hate to bother you, and I don't *think* it's that big of a deal to do, but instead of opening into iframe, can you help me open it into the php 'switch' div? Reason: The height of the iframe, I think you know the rest...Don't like to use javascript for something like that.
Here's a bit of 'switch' code that works:
Code: [ Select ]
<style type="text/css">
#target {
width: 300px;
height: 300px;
background-color: #00FFCC;
border: 1px solid #000;
text-align: center;
vertical-align:middle;
margin: 0 auto;
padding: 10px; }
</style>
<body>
<a href="index.php?page=main">page1</a>
<a href="index.php?page=2"><br />page2</a>
<a href="index.php?page=3"><br />page3</a>
<p />
<div id="target">
<?php
switch ($_GET['page'])
{
case "main": include '1.php'; break;
case "2": include '2.php'; break;
case "3": include '3.php'; break;
default: include '1.php';
}
?>
</div>
</body>
</html>
- <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>
- ScottG
- Proficient


- Joined: Jul 06, 2010
- Posts: 260
- Status: Offline
You should be able to change the results.php to this
and just include it in the div
If I'm not mistaken the results page returns nothing if the variables are not setup.
PHP Code: [ Select ]
<?php
// How many adjacent pages should be shown on each side?
$adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)
//how many items to show per page
$limit = 10;
//Number of ads per row
$rows = 3;
//This creates the menu at the top A-Z
$char = $_GET['letter'];
$list="num";
if(!empty($char)){
include('connect.php');
$tbl_name="amp_ads"; //your table name
/*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";
elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";
else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
/* Setup vars for query. */
if(!empty($char)) $targetpage = "results.php?letter=$char&";
else $targetpage = "az.php?"; //your file name (the name of this file)
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0
/* Get data. */
if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";
elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";
else $sql = "SELECT * FROM $tbl_name WHERE title LIKE '$char%' LIMIT $start, $limit";
$result = mysql_query($sql);
/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var is given, default to 1.
$prev = $page - 1; //previous page is page - 1
$next = $page + 1; //next page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last page minus 1
/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
{
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";
else
$pagination.= "<span class=\"disabled\">« previous </span>";
//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
}
//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";
else
$pagination.= "<span class=\"disabled\"> next »</span>";
$pagination.= "</div>\n";
}
echo '<div id="ad-wrapper">';
if($total_pages==0) echo "No Results for ".$char."!";
else{
$c = -1;
while($row = mysql_fetch_array($result))
{
if($c%$rows==$rows-1) echo "<br/>";
echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
$c++;
$c++;
}
}
}
echo $pagination;
?>
// 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;
?>
- <?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;
- ?>
and just include it in the div
Code: [ Select ]
<div id="target">
<?php
include 'results.php';
?>
</div>
<?php
include 'results.php';
?>
</div>
- <div id="target">
- <?php
- include 'results.php';
- ?>
- </div>
If I'm not mistaken the results page returns nothing if the variables are not setup.
- Brian Jester
- Beginner


- Joined: Jan 06, 2006
- Posts: 61
- Loc: Bayonne, New Jersey USA
- Status: Offline
- ScottG
- Proficient


- Joined: Jul 06, 2010
- Posts: 260
- Status: Offline
Sorry I sent that out untested I forgot to add a few things
I missed something in the results.php
az.php
index.php
EDIT:: I typed slower than I was thinking just now so I fixed what i was saying at the top as well as the code tags that I messed up. This is a working example minus Mysql stuff. This will reload the parent page however it will load the contents into the target div.
I missed something in the results.php
Code: [ Select ]
<?php
// How many adjacent pages should be shown on each side?
$adjacents = 1; //This only applies to lists that are more then 8 pages (controls the ...'s not the list)
//how many items to show per page
$limit = 10;
//Number of ads per row
$rows = 3;
//This creates the menu at the top A-Z
$char = $_GET['letter'];
$list="num";
if(!empty($char)){
include('connect.php');
$tbl_name="amp_ads"; //your table name
/*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
if((empty($char))||($char=="*")) $query = "SELECT COUNT(*) as num FROM $tbl_name";
elseif($char=="num") $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title REGEXP '^[0-9]'";
else $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE title LIKE '$char%'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
/* Setup vars for query. */
if(!empty($char)) $targetpage = $_SERVER['PHP_SELF'] . "?letter=$char&";
else $targetpage = "az.php?"; //your file name (the name of this file)
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0
/* Get data. */
if($char=="*") $sql = "SELECT * FROM $tbl_name LIMIT $start, $limit";
elseif($char=="num") $sql = "SELECT * FROM $tbl_name WHERE title REGEXP '^[0-9]' LIMIT $start, $limit";
else $sql = "SELECT * FROM $tbl_name WHERE title LIKE '$char%' LIMIT $start, $limit";
$result = mysql_query($sql);
/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var is given, default to 1.
$prev = $page - 1; //previous page is page - 1
$next = $page + 1; //next page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last page minus 1
/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
{
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"$targetpage"."page=$prev\">« previous </a>";
else
$pagination.= "<span class=\"disabled\">« previous </span>";
//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage"."page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage"."page=$lastpage\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"$targetpage"."page=1\">1</a>";
$pagination.= "<a href=\"$targetpage"."page=2\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage"."page=$counter\">$counter</a>";
}
}
}
//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"$targetpage"."page=$next\"> next »</a>";
else
$pagination.= "<span class=\"disabled\"> next »</span>";
$pagination.= "</div>\n";
}
echo '<div id="ad-wrapper">';
if($total_pages==0) echo "No Results for ".$char."!";
else{
$c = -1;
while($row = mysql_fetch_array($result))
{
if($c%$rows==$rows-1) echo "<br/>";
echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"><p /> $row[alt]";
$c++;
$c++;
}
}
}
echo $pagination;
?>
// 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;
?>
- <?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;
- ?>
az.php
Code: [ Select ]
<div id="aznavbar" class="drop-shadow raised">
<?php
//This creates the menu at the top A-Z
$char = $_GET['letter'];
$list="num";
foreach (range('A', 'Z') as $i) $list.=",$i";
$list.=",Show All Ads";
$a = explode(',', $list);
foreach ($a as $b) {
if (!empty($b)) {
if ($b=="num") {
if ($char=="num") echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=num\">#</a>";
else echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=num\">#</a>";
}
elseif ($b=="Show All Ads") {
if (($char=="*")||(empty($char))) echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=*\">Show All Ads</a>";
else echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=*\">Show All Ads</a>";
}
elseif($b==$char) echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=".$b."\">$b</a>";
else echo "<a href=\"" .$_SERVER['PHP_SELF'] . "?letter=".$b."\">$b</a>";
}
}
?>
</div>
<?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>
- <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>
index.php
Code: [ Select ]
<html>
<head> <title> </title>
<meta name="viewport" content="initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/breadcrumb.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="screen" charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/menu.css" media="screen" charset="utf-8" />
<style media="screen" type="text/css">
html, body { }
#aznavbar a:link {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
margin-left: 4.15px;
padding: 10px;
text-decoration:none;
}
#aznavbar a:visited {
color: #0C7FB0;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:hover {
background-color: #FA6405;
color:#000;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar a:active{
color:#FA6405;
font-family:Verdana,Geneva,'DejaVu Sans',sans-serif;
padding: 10px;
text-decoration:none;
}
#aznavbar {
background: #141414;
background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#32323a', EndColorStr='#141414', GradientType=0);
border: 1px solid #000;
margin: -10px 0px 0px -8px;
padding: 10 0px 10px 80px;
width: 94.8%;
}
a:hover#showall {
}
#ad-wrapper{
margin:0px auto 0px auto;
text-align:center;
}
</style>
</head>
<body>
<?php include('az.php'); ?>
<div class="drop-shadow lifted" id="header"><img src="/test2/images/logo.png" alt="Reunite My Site - Company Logo" title="Reunite My Site - Company Logo"> </div>
<div id="login">Login: <input type="username" class="login" size="20px;">
<br />
Password: <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>
<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: <input type="username" class="login" size="20px;">
<br />
Password: <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>
- <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: <input type="username" class="login" size="20px;">
- <br />
- Password: <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>
EDIT:: I typed slower than I was thinking just now so I fixed what i was saying at the top as well as the code tags that I messed up. This is a working example minus Mysql stuff. This will reload the parent page however it will load the contents into the target div.
- Brian Jester
- Beginner


- Joined: Jan 06, 2006
- Posts: 61
- Loc: Bayonne, New Jersey USA
- Status: Offline
- ScottG
- Proficient


- Joined: Jul 06, 2010
- Posts: 260
- Status: Offline
- Brian Jester
- Beginner


- Joined: Jan 06, 2006
- Posts: 61
- Loc: Bayonne, New Jersey USA
- Status: Offline
I hope I am not too late...
I need to output the results in multiple columns, something like a variable like: $cols = 4 will allow 4 records to display across the page, then automatically break to the next row. As it stands now, the output shows ads in a single column (several rows down the page).
Thank you in advance Scott!
Brian
I need to output the results in multiple columns, something like a variable like: $cols = 4 will allow 4 records to display across the page, then automatically break to the next row. As it stands now, the output shows ads in a single column (several rows down the page).
Thank you in advance Scott!
Brian
- ScottG
- Proficient


- Joined: Jul 06, 2010
- Posts: 260
- Status: Offline
Ok a couple things I've found.
First the when you build out the links (bottom of results.php page). In the while loop the link Isn't being closed with an </a> tag also in between the image and the text there is a random <p />. So in the test I put together I took out the < p /> And added an </a> to the end of the text.
This happened to make the script kind of work the next thing I noticed was (also in the while loop at the bottom) you had a c++; followed by another c++; which was messing with your $rows variable. Taking out one of these variables will make your script work correctly.
See the quoted text for reference
Here is an altered while loop that should work for you
I am going to attach the test info I have as well. Warning Using this will not help you as I force fake database information to give me results I am providing it as a reference material only. This will give you an idea if the resulting changes are the desired effect.
First the when you build out the links (bottom of results.php page). In the while loop the link Isn't being closed with an </a> tag also in between the image and the text there is a random <p />. So in the test I put together I took out the < p /> And added an </a> to the end of the text.
This happened to make the script kind of work the next thing I noticed was (also in the while loop at the bottom) you had a c++; followed by another c++; which was messing with your $rows variable. Taking out one of these variables will make your script work correctly.
See the quoted text for reference
Quote:
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++;
}
{
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++;
}
Here is an altered while loop that should work for you
PHP Code: [ Select ]
while($row = mysql_fetch_array($result))
{
if($c%$rows==$rows-1) echo "<br/>";
echo "<a href=\"details.php?id=$row[n] \"><img class=\"ads\" alt=\"$row[alt]\" title=\"$row[alt]\" src=\"$row[banner]\"> $row[alt]</a>";
$c++;
}
{
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++;
}
- 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++;
- }
I am going to attach the test info I have as well. Warning Using this will not help you as I force fake database information to give me results I am providing it as a reference material only. This will give you an idea if the resulting changes are the desired effect.
Attachments:
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
January 3rd, 2013, 8:13 am
1, 2
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 18 posts
- Users browsing this forum: No registered users and 140 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
