|
|
|
| друзья помогите прикрутить постраничную навигацию для етой страницы. чтобы было количество записей по 9
<?php
include ("blocks/bd.php");
$result = mysql_query("SELECT title,meta_d,meta_k,text FROM settings WHERE page='photo'",$db);
$myrow = mysql_fetch_array($result);
?>
<!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">
<head>
<meta name="description" content="<?php echo $myrow['meta_d']; ?> ">
<meta name="keywords" content="<?php echo $myrow['meta_k']; ?> ">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title><?php echo $myrow['title']; ?></title>
<link href="style2.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body{font:12px/1.2 Verdana, Arial, san-serrif; padding:0 10px;}
a:link, a:visited{text-decoration:none; color:#416CE5; border-bottom:1px solid #416CE5;}
h2{font-size:13px; margin:15px 0 0 0;}
</style>
<link media="screen" rel="stylesheet" href="colorbox.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="colorbox/colorbox/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
//Examples of how to assign the ColorBox event to elements
$("a[rel='example1']").colorbox();
$("a[rel='example2']").colorbox({transition:"fade"});
$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
$("a[rel='example4']").colorbox({slideshow:true});
$(".example5").colorbox();
$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
$(".example7").colorbox({width:"80%", height:"80%", iframe:true});
$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
$(".example9").colorbox({
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
});
//Example of preserving a JavaScript event for inline calls.
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
return false;
});
});
</script>
</head>
<body>
<div style="position:relative;">
<img src="img/fon2.png" width="100%" height="100%" style="position:fixed;" />
<div style="position:absolute; top:0px; left:0.5%; right:0.5%; padding-bottom:0px;" >
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0" height="100%" style="padding-top:50px; margin-top:50px;">
<tr>
<td width="120" align="center" valign="middle" id="banners"><a href="/" title=""><img src="img/glavnaja.png" alt="Главная страница сайта" title="Главная страница сайта" /></a><br><br><br><a href="/photo.php" title=""><img src="img/gallery.png" alt="Галерея" title="Галерея" /></a><br><br><br><a href="/lymworu.php" title=""><img src="img/lymworu.png" alt="Про Лумшори" title="Про Лумшори" /></a></td>
<td width="700" height="400px" align="center" valign="middle" class="center" style="padding:40px; margin:40px;"><?
$result2 = mysql_query("SELECT title,meta_d,meta_k,img FROM photo ORDER by id DESC",$db);
if (!$result2)
{
echo "<p>Запрос на выборку данных из базы не прошел. Напишите об этом администратору serega2101@i.ua. <br> <strong>Код ошибки:</strong></p>";
exit(mysql_error());
}
if (mysql_num_rows($result2) > 0)
{
$myrow2 = mysql_fetch_array($result2);
do
{
printf ("<div style='width:230px;float:left;'><table width='202' height='202' border='0' cellspacing='0' cellpadding='0' style='padding:1px; margin:1px;'>
<tr>
<td style='border:1px solid #000000; background-color:#ffffff; padding:2px; margin:2px;'><a href='%s' rel='example1' title='%s'><img src='%s' title='%s' width='200'></a>
</td>
</tr>
</table></div>",$myrow2["img"],$myrow2["title"], $myrow2["img"], $myrow2["title"]);
}
while ($myrow2 = mysql_fetch_array($result2));
}
else
{
echo "<p>Информация по запросу не может быть извлечена в таблице нет записей.</p>";
exit();
}
?></td>
<td width="120" align="center" valign="middle" id="banners"><a href="/rooms.php" title=""><img src="img/nomera.png" alt="Номера" title="Номера" /></a><br><br><br><a href="/contacts.php" title=""><img src="img/contacts.png" alt="Контакти" title="Контакти" /></a><br><br><br><a href="/pogoda.php" title=""><img src="img/pogoda.png" alt="Погода в Лумшорах" title="Погода в Лумшорах" /></a></td>
</tr>
</table>
</div>
</div>
</body>
</html>
|
| |
|
|
|
|
|
|
|
для: milanello
(23.07.2010 в 16:04)
| | ВОТ пример для начала | |
|
|
|
|
|
|
|
для: Slo_Nik
(23.07.2010 в 16:43)
| | сделал уже только не етим методом)
если надо выложу | |
|
|
|
|
|
|
|
для: milanello
(23.07.2010 в 16:52)
| | конечно надо, а как вы думаете | |
|
|
|
|
|
|
|
для: psychomc
(23.07.2010 в 17:09)
| |
<?php
include ("blocks/bd.php");
$result = mysql_query("SELECT title,meta_d,meta_k,text FROM settings WHERE page='photo'",$db);
$myrow = mysql_fetch_array($result);
?>
<!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">
<head>
<meta name="description" content="<?php echo $myrow['meta_d']; ?> ">
<meta name="keywords" content="<?php echo $myrow['meta_k']; ?> ">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title><?php echo $myrow['title']; ?></title>
<link href="style2.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body{font:12px/1.2 Verdana, Arial, san-serrif; padding:0 10px;}
a:link, a:visited{text-decoration:none; color:#416CE5; border-bottom:1px solid #416CE5;}
h2{font-size:13px; margin:15px 0 0 0;}
</style>
<link media="screen" rel="stylesheet" href="colorbox.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="colorbox/colorbox/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
//Examples of how to assign the ColorBox event to elements
$("a[rel='example1']").colorbox();
$("a[rel='example2']").colorbox({transition:"fade"});
$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
$("a[rel='example4']").colorbox({slideshow:true});
$(".example5").colorbox();
$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
$(".example7").colorbox({width:"80%", height:"80%", iframe:true});
$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
$(".example9").colorbox({
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
});
//Example of preserving a JavaScript event for inline calls.
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
return false;
});
});
</script>
</head>
<body>
<div style="position:relative;">
<img src="img/fon2.png" width="100%" height="100%" style="position:fixed;" />
<div style="position:absolute; top:0px; left:0.5%; right:0.5%; padding-bottom:0px;" >
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0" height="100%" style="padding-top:50px; margin-top:50px;">
<tr>
<td width="120" align="center" valign="middle" id="banners"><a href="/" title=""><img src="img/glavnaja.png" alt="Главная страница сайта" title="Главная страница сайта" /></a><br><br><br><a href="/photo.php?page=1" title=""><img src="img/gallery.png" alt="Галерея" title="Галерея" /></a><br><br><br><a href="/lymworu.php" title=""><img src="img/lymworu.png" alt="Про Лумшори" title="Про Лумшори" /></a></td>
<td width="700" height="400px" align="center" valign="middle" class="center" style="padding:40px; margin:40px;">
<?
include ("blocks/bd.php");
$vivod='9';
if($_GET['page']==0){$_GET['page']=1;}
$page=$_GET['page'];
$j = $_GET['page']*$vivod-$vivod;
$query11 = "SELECT * from photo";
$res11 = mysql_query($query11) or die(mysql_error());
$number11 = mysql_affected_rows();
$x = ceil($number11 / $vivod);
$query="SELECT * FROM photo ORDER BY id DESC limit ".$j.",".$vivod;
$res=mysql_query($query);
while ($row=mysql_fetch_array($res)) {
?>
<div style='width:230px;float:left;'><table width='202' height='202' border='0' cellspacing='0' cellpadding='0' style='padding:1px; margin:1px;'>
<tr>
<td style='border:1px solid #000000; background-color:#ffffff; padding:2px; margin:2px;'><a href='<? echo $row['img']; ?>' rel='example1' title='<? echo $row['title']; ?>'><img src='<? echo $row['img']; ?>' title='<? echo $row['title']; ?>' width='200'></a>
</td>
</tr>
</table></div>
<?
}
echo "<br/><div style='float:left; width:700px;'>";
for($i=1;$i<$x+1;$i++)
{
if ($i==$page) {
echo "<a style='color:orange; bottom:0;' >".$i."</a> ";
} else {
echo "<a style='color:red; bottom:0;' href = \"photo.php?page=".$i."\">".$i."</a> ";
}}
echo "</div>"; ?>
</td>
<td width="120" align="center" valign="middle" id="banners"><a href="/rooms.php" title=""><img src="img/nomera.png" alt="Номера" title="Номера" /></a><br><br><br><a href="/contacts.php" title=""><img src="img/contacts.png" alt="Контакти" title="Контакти" /></a><br><br><br><a href="/pogoda.php" title=""><img src="img/pogoda.png" alt="Погода в Лумшорах" title="Погода в Лумшорах" /></a></td>
</tr>
</table>
</div>
</div>
</body>
</html>
|
| |
|
|
|
|
|
|
|
для: milanello
(23.07.2010 в 17:13)
| | $vivod=9;
А "href://url?page=фигня" вполне не отвечают условию if($_GET['page']==0).... ну и вся ваша арифметика.... | |
|
|
|
|
|
|
|
для: sim5
(23.07.2010 в 17:22)
| | писал не я.
друг скинул его навигацию. я скопировал и сделал под себя.
фигня не фигня а работает на ура | |
|
|
|