Liste des pages ( 28 / 207 )
Liste des pages ( 28 / 207 )
a
b
c
d
e
f
g
h
i
j
k
l
m
<?php
/**
* @file multipage.php
* @brief Page d'essai de menu pour multipage avec beaucoup de pages.
*
* @author hughes monget
* @see http://monget.com/
*/
?>
<!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="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>test multipage</title>
<script type="text/javascript">
<!--;
function on_load()
{
if (!document || !document.getElementById)
{
return
}
// Gestion du rollover sur le menu déroulant.
var obj_menu_deroulant = document.getElementById("bouton_affichage")
var obj_sous_menu = document.getElementById("liste_cachee")
if (obj_menu_deroulant && obj_sous_menu && obj_menu_deroulant.style && obj_sous_menu.style)
{
// Mouseover.
// On rend le menu invisible en javascript: xomme ça,
// si le js est désactivé, le menu sera visible.
obj_sous_menu.style.display = "none"
var callback_onmouseover = function()
{
if (obj_sous_menu.style.display == "none")
{
obj_sous_menu.style.display = "block"
}
}
obj_menu_deroulant.onmouseover = callback_onmouseover
obj_sous_menu.onmouseover = callback_onmouseover
// Mouseout.
var callback_onmouseout = function()
{
if (obj_sous_menu.style.display == "block")
{
obj_sous_menu.style.display = "none"
}
}
obj_menu_deroulant.onmouseout = callback_onmouseout
obj_sous_menu.onmouseout = callback_onmouseout
}
}
// -->
</script>
<style type="text/css">
<!--
body
{
color: #000;
}
div.liste_complete a, div.liste_allegee a, div.liste_glissante a
{
color: #00f;
text-decoration: none;
font-size: 9px;
}
div.liste_allegee a
{
font-size: 12px;
}
div.liste_complete a.cur, div.liste_allegee a.cur, div.liste_glissante a.cur
{
color: #f00;
border-bottom: 1px solid #f00;
}
div.liste_complete a.dizaine
{
background: #eee;
}
div.liste_selection .changer_page
{
margin: 0;
padding: 0;
}
/* ================================================================
This copyright notice must be untouched at all times.
The original version of this stylesheet and the associated (x)html
is available at http://www.cssplay.co.uk/menus/basic_dd.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This stylesheet and the assocaited (x)html may be modified in any
way to fit your requirements.
=================================================================== */
/* remove the bullets, padding and margins from the lists */
.liste_numero_page
{
display: block;
height: 25px;
}
.liste_numero_page ul
{
list-style-type: none;
margin: 0;
padding: 0;
}
/* make the top level links horizontal and position relative so that we can position the sub level */
.liste_numero_page li
{
float: left;
position: relative;
z-index: 100;
}
/* use the table to position the dropdown list */
.liste_numero_page table
{
border-collapse: collapse;
left: -1px;
position: absolute;
top: 25px;
z-index: 80;
}
/* style all the links */
.liste_numero_page a, .liste_numero_page :visited
{
display: block;
color: #000;
background: #eee;
font-size: 12px;
margin-right: 1px;
padding: 7px 0;
text-align: center;
text-decoration: none;
width: 25px;
}
/* style the links hover */
.liste_numero_page :hover
{
background: #ccc;
color: #444;
}
/* hide the sub level links */
.liste_numero_page ul ul
{
height: 0;
position: absolute;
visibility: hidden;
width: 25px;
}
/* make the sub level visible on hover list or link */
.liste_numero_page ul li:hover ul, .liste_numero_page ul a:hover ul
{
visibility: visible;
}
#bouton_affichage
{
}
#position_mouseover
{
position: relative;
}
#position_mouseover span
{
border: 1px dotted #ccc;
background: #f0f0f0;
}
#liste_mouseover
{
display: none;
visibility: hidden;
float: left;
position: absolute;
top: 20px;
left: 1px;
background: cyan;
padding: 5px;
background: #f0f0f0;
border-bottom: 1px dotted #ccc;
border-right: 1px dotted #ccc;
}
-->
</style>
</head>
<body onload="on_load()">
<?php
// Gestion du paramètre http.
define('SN', $_SERVER['SCRIPT_NAME']);
define('INT_MAX_ELEMENT', 207);
define('HTTP_PAGE', 'p');
$int_page_courante = 1;
if (isset($_REQUEST[HTTP_PAGE]))
{
$int_tmp = intval($_REQUEST[HTTP_PAGE]);
if ($int_tmp > 0 && $int_tmp <= INT_MAX_ELEMENT)
{
$int_page_courante = $int_tmp;
}
}
//------------------------------------------------------------------------------
echo "\n",
'<hr />',
'<div class="liste_complete">';
for ($ii = 1; $ii <= INT_MAX_ELEMENT; $ii++)
{
$str_classe = '';
if ($int_page_courante === $ii)
{
$str_classe .= ' cur';
}
if (($ii % 10) == 0)
{
$str_classe .= ' dizaine';
}
if ($str_classe)
{
$str_classe = ' class="'.$str_classe.'"';
}
echo '<a href="'.SN.'?'.HTTP_PAGE.'='.$ii.'"'.$str_classe.'>'.$ii.'</a>';
if ($ii < INT_MAX_ELEMENT) { echo ' - '; }
}
echo '</div>';
//------------------------------------------------------------------------------
echo "\n",
'<hr />',
'<div class="liste_selection">';
echo
'<form class="changer_page" action="">',
'<select name="',HTTP_PAGE,'" onchange="this.form.submit();">';
for ($ii = 1; $ii <= INT_MAX_ELEMENT; $ii++)
{
$str_classe = '';
if (($ii % 10) == 0)
{
$str_classe = ' class="dizaine"';
}
$str_selected = '';
if ($int_page_courante === $ii)
{
$str_selected = ' selected="selected"';
}
echo '<option',$str_classe,$str_selected,'>',$ii,'</option>';
}
echo
'</select>',
' ',
'<input type="submit" value="go" />',
'</form>';
echo '</div>';
//------------------------------------------------------------------------------
$arr_arr_int_page = range(0, INT_MAX_ELEMENT);
$arr_arr_int_page = array_chunk($arr_arr_int_page, 10);
unset($arr_arr_int_page[0][0]);
echo "\n",
'<hr />',
'<div class="liste_numero_page">',
'<ul>';
foreach ($arr_arr_int_page as $arr_int_page)
{
$ii = array_shift($arr_int_page);
echo "\n",
'<li><a href="',SN,'?',HTTP_PAGE,'=',$ii,'">',$ii,'<!--[if IE 7]><!--></a><!--<![endif]-->',
'<!--[if lte IE 6]><table><tr><td><![endif]-->';
if ($arr_int_page)
{
echo '<ul>';
foreach ($arr_int_page as $ii)
{
echo "\n",'<li><a href="',SN,'?',HTTP_PAGE,'=',$ii,'">',$ii,'</a></li>';
}
echo '</ul>';
}
echo
'<!--[if lte IE 6]></td></tr></table></a><![endif]-->',
'</li>';
}
echo
'</ul>',
'</div>';
//------------------------------------------------------------------------------
echo "\n",
'<hr />',
'<div class="liste_allegee">';
$int_intervalle = 10;
function echo_a($ii, $int_page_courante)
{
$str_classe = '';
if ($int_page_courante === $ii)
{
$str_classe = ' class="cur"';
}
echo ' <a href="'.SN.'?'.HTTP_PAGE.'='.$ii.'"'.$str_classe.'>'.$ii.'</a> ';
}
$int_minimum = max(0, $int_page_courante - $int_intervalle);
$int_maximum = min(INT_MAX_ELEMENT + 1, $int_page_courante + $int_intervalle);
$bool_3_points = false;
for ($ii = 1; $ii <= INT_MAX_ELEMENT; $ii++)
{
if (($ii % 10) == 0)
{
echo_a($ii, $int_page_courante);
$bool_3_points = true;
}
else
{
if ($int_minimum < $ii && $ii < $int_maximum)
{
echo_a($ii, $int_page_courante);
}
else
{
if ($bool_3_points)
{
echo '...';
$bool_3_points = false;
}
}
}
}
echo '</div>';
//------------------------------------------------------------------------------
echo "\n",
'<hr />',
'<div class="liste_glissante">';
$int_dizaine = intval(floor($int_page_courante / 10)) * 10;
$int_minimum = max(1, $int_dizaine);
$int_maximum = min(INT_MAX_ELEMENT, $int_dizaine + 9);
if ($int_minimum != 1)
{
echo '<a href="'.SN.'?'.HTTP_PAGE.'='.($int_dizaine-10).'"'.$str_classe.'><<</a> ... ';
}
for ($ii = $int_minimum; $ii <= $int_maximum; $ii++)
{
echo_a($ii, $int_page_courante);
if ($ii != INT_MAX_ELEMENT && $ii != $int_maximum)
{
echo ' - ';
}
}
if ($int_maximum != INT_MAX_ELEMENT)
{
echo ' ... <a href="'.SN.'?'.HTTP_PAGE.'='.($int_dizaine+10).'"'.$str_classe.'>>></a> ';
}
echo '</div>';
//------------------------------------------------------------------------------
echo "\n",
'<hr />';
echo <<<JS
<script type="text/javascript">
<!--;
function afficherListePages()
{
document.getElementById('liste_mouseover').style.visibility = 'visible'
document.getElementById('liste_mouseover').style.display = 'block'
}
function cacherListePages()
{
document.getElementById('liste_mouseover').style.visibility = 'hidden'
document.getElementById('liste_mouseover').style.display = 'none'
}
//-->
</script>
JS;
echo '<div id="position_mouseover"><span onmouseover="afficherListePages()" onmouseout="cacherListePages()">Liste des pages ( ',$int_page_courante,' / ',INT_MAX_ELEMENT,' )</span>';
echo '<div id="liste_mouseover" class="liste_complete" onmouseover="afficherListePages()" onmouseout="cacherListePages()">';
for ($ii = 1; $ii <= INT_MAX_ELEMENT; $ii++)
{
$str_classe = '';
if ($int_page_courante === $ii)
{
$str_classe .= ' cur';
}
if (($ii % 10) == 0)
{
$str_classe .= ' dizaine';
}
if ($str_classe)
{
$str_classe = ' class="'.$str_classe.'"';
}
echo '<a href="'.SN.'?'.HTTP_PAGE.'='.$ii.'"'.$str_classe.'>'.$ii.'</a>';
if ($ii < INT_MAX_ELEMENT) { echo ' - '; }
}
echo '</div>';
echo '</div>';
//------------------------------------------------------------------------------
echo "\n",
'<hr />';
echo '<div id="bouton_affichage">Liste des pages ( ',$int_page_courante,' / ',INT_MAX_ELEMENT,' )';
echo '<div id="liste_cachee" class="liste_complete">';
for ($ii = 1; $ii <= INT_MAX_ELEMENT; $ii++)
{
$str_classe = '';
if ($int_page_courante === $ii)
{
$str_classe .= ' cur';
}
if (($ii % 10) == 0)
{
$str_classe .= ' dizaine';
}
if ($str_classe)
{
$str_classe = ' class="'.$str_classe.'"';
}
echo '<a href="'.SN.'?'.HTTP_PAGE.'='.$ii.'"'.$str_classe.'>'.$ii.'</a>';
if ($ii < INT_MAX_ELEMENT) { echo ' - '; }
}
echo '</div>';
echo '</div>';
//--- hr final
echo '<hr />';
foreach(range('a', 'm') as $ii) { echo $ii, '<br />'; }
echo '<hr />';
highlight_file(__FILE__);
?>
</body>
</html>