Ver Mensaje Individual
  #10 (permalink)  
Antiguo 02/03/2012, 19:31
Avatar de mazaku
mazaku
 
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

disculpa si es mucha molestia repara2 pero sigue sin funcionar correctamente

te dejo un enlace para que veas la galeria en accion. galeria2.php

este es el codigo ya modifique lo que me comentaste

Código PHP:
<?php 
session_start
();
include (
'config.php');
include (
'config.php');
$c_capitulo $_GET['capitulo']; // Esto recoje los datos de la variable id en la url.
$registros=mysql_query("SELECT * FROM capitulos WHERE c_capitulo='$c_capitulo'",  
           
$db_link) or
  die(
"Problemas en el select:".mysql_error());
while (
$reg=mysql_fetch_array($registros))
{

?>
<?php 
$direct 
="".$reg['c_path']."";// 
function loadPics($pics)

{
 global 
$direct;
    if (
$dir = @opendir("$direct/")) 
    {
        while(
$file readdir($dir)) 
        {
            if(
preg_match("/\.jpg$|\.gif$|\.png$/"$file))
                
array_push($pics$file);
        }  
        
        
closedir($dir);
    }
    
    
sort($pics);
    return 
$pics;
}

function 
listPics($pics)
{
    while(list(
$num$pic) = each($pics))
    {
    global 
$c_capitulo;
        echo 
"<option value='".$_SERVER['PHP_SELF']."?capitulo=$c_capitulo&c=$num'>".getPicName($num$pics)."</option>\n";
    }
}

function 
showPic($c$pics)
{
global 
$direct;
    
$pic $pics[$c];
    echo 
"<!-- $c -->\n";
    echo 
"<img src=\"$direct/$pic\" width=728'>";
}

function 
getPrev($c$pics)
{
    if(
$c<=0) return 1;
    if(
== $c) return 1;
    if(
$c <= count($pics)) return $c 1;
    elseif(
$c == count($pics)) return $c;
}
 
function 
getNext($c$pics)
{
    if(
$c count($pics)) return $c 1;
    elseif(
$c == count($pics)) return (count($pics)-1);
    elseif(
$c>count($pics)) return (count($pics)-1);
}
function 
getPicName($c$pics)
{
    return 
preg_replace("/\.jpg$|\.gif$|\.png$/i"""$pics[$c]);
}

$pics = array();
$pics loadPics($pics);

if(!isset(
$_REQUEST['c'])) $_REQUEST['c'] = 0;

?>


<!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 http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>manganix.net / <?php echo "".$reg['s_serie']."-".$reg['c_capitulo'].""?> pagina:"<?=getPicName($_REQUEST['c'], $pics)?>"</title>


<style type="text/css">

body {
    background: #26172D;
    font: 11px/16px arial, helvetica, sans-serif;
    color: #363333;
    margin: 0;
    padding: 0;
    }
table, tr, td {
    font: 11px/16px arial, helvetica, sans-serif;
    color: #cccccc;
    border-collapse: collapse;
    border: none;
    margin: 0;
    padding: 0;
    }
    
#header { background-color:#0182a7;

 }

#title {
    font-size: 12px;
    color: #fff;
    padding: 12px;
    
    }
    #title a {
    color: #fff;
    text-decoration: none;
    
    }
    #title a:hover {
    color: #abdb30;
    text-decoration: none;
    
    }
#dropdownNav {
    background: #E8F8FF;
    float: right;
    font-weight: bold;
    color: #000000;
    border-left: 1px solid #cccccc;
    padding: 10px 30px 12px 30px;
    }
    
.navigation {
    background: #cccccc;
    border-top: 2px solid #b6b6b6;
    border-bottom: 2px solid #b6b6b6;
    width: 100%;
    }
.navLeft {
    text-align: left;
    padding: 10px 20px;
    width: 50%;
    font-weight: bold;
    font-size: 12px;
    }
.navRight {
    text-align: right;
    padding: 10px 20px;
    width: 50%;
    font-weight: bold;
    font-size: 12px;
    }

#container {
    background: #fff;
    margin: 0;
    padding: 0;
    width: 100%;
        }
#index {
    background: #e7e7e7;
    vertical-align: top;
    padding: 0;
    border-right: 1px dashed #d7dee2;
    white-space: nowrap;
    width: 200px;
    }
#index ul {
    margin: 0;
    padding: 0;
    }
#index ul li {
    list-style: none;
    font-weight: bold;
    border-bottom: 1px dashed #d5d5d5;
    }
    
#design {
    vertical-align: top;
    padding: 20px;
    text-align: center;
    }
    
p, h1 { margin-top: 0; }

a:link, a:active, a:visited {
    color: #004f86;
    text-decoration: none;
    }
a:hover {
    color: #0072c1;
    text-decoration: none;
    }

.navigation a:link, .navigation a:active, .navigation a:visited {
    color: #fff;
    text-decoration: none;
    }
.navigation a:hover {
    color: #ddd;
    text-decoration: none;
    }
    
#index a:link, #index a:active, #index a:visited {
    background: #f3f3f3;
    text-decoration: none;
    padding: 5px 10px;
    display: block;
    }

#index a:hover {
    background: #f9f9f9;
    text-decoration: none;
    padding: 5px 10px;
    display: block;
    }
    
img { border: none; }

#design img {
    padding: 4px;
    border: 1px dashed #d7dee2;
    }
    
#footer {
    padding: 20px;
    color: #858585;
    font-size: 11px;
    }
#footer a:link, #footer a:active, #footer a:visited {
    color: #858585;
    text-decoration: none;
    }
#footer a:hover { color: #a1a1a1;}

form {
    margin: 0;
    padding: 0;
    }
select {
    font: 11px/16px arial, helvetica, sans-serif;
    color: #363333;
    margin: 0 0 0 5px;
    padding: 0;
    }
    /* --------------- BOTONES --------------- */

.button, .button:visited { /* botones genéricos */
background: #222 url(http://sites.google.com/site/zavaletaster/Home/overlay.png) repeat-x;
display: inline-block;
padding: 5px 10px 6px;
color: #FFF;
text-decoration: none;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
border-top: 0px;
border-left: 0px;
border-right: 0px;
border-bottom: 1px solid rgba(0,0,0,0.25);
position: relative;
cursor:pointer;
}

button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner {
border: none;
}

.button:hover { /* el efecto hover */
background-color: #111
color: #FFF;
}

.button:active{ /* el efecto click */
top: 1px;
}

/* botones pequeños */
.small.button, .small.button:visited {
font-size: 11px ;
}

/* botones medianos */
.button, .button:visited,.medium.button, .medium.button:visited {
font-size: 13px;
font-weight: bold;
line-height: 1;
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
}

/* botones grandes */
.large.button, .large.button:visited {
font-size:14px;
padding: 8px 14px 9px;
}

/* botones extra grandes */
.super.button, .super.button:visited {
font-size: 34px;
padding: 8px 14px 9px;
}

.pink.button { background-color: #E22092; }
.pink.button:hover{ background-color: #C81E82; }

.green.button, .green.button:visited { background-color: #91BD09; }
.green.button:hover{ background-color: #749A02; }

.red.button, .red.button:visited { background-color: #E62727; }
.red.button:hover{ background-color: #CF2525; }

.orange.button, .orange.button:visited { background-color: #FF5C00; }
.orange.button:hover{ background-color: #D45500; }

.blue.button, .blue.button:visited { background-color: #2981E4; }
.blue.button:hover{ background-color: #2575CF; }

.yellow.button, .yellow.button:visited { background-color: #FFB515; }
.yellow.button:hover{ background-color: #FC9200; }
    
</style>

<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>


</head>

<body>

<div id="header">

    <div id="dropdownNav">
        <form name="menu">
          <select name="jumpMenu" onChange="MM_jumpMenu('parent',this,0)">
              <option><?=getPicName($_REQUEST['c'], $pics)?></option>
            <? listPics($pics); ?>
          </select>
        </form>
    </div>

    <div id="title"><a href="http://manganix.uni.me">manganix.net </a> / <a href="index.php?sec=capitulos&serie=<?php echo "".$reg['direccion'].""?>"><?php echo "".$reg['s_serie'].""?></a> / <?php echo "".$reg['c_capitulo'].""?> / <?=getPicName($_REQUEST['c'], $pics)?></div>
    
</div>

<table class="navigation">
    <tr>
        <td class="navLeft"><a href=<?=$PHP_SELF?>?capitulo=<?php echo "$c_capitulo"?>&c=<?=getPrev($_REQUEST['c'], $pics)?> class="button medium green">&laquo; Anterior</a></td>
        <td class="navRight"><a href=<?=$PHP_SELF?>?capitulo=<?php echo "$c_capitulo"?>&c=<?=getNext($_REQUEST['c'], $pics)?> class="button medium green">Siguiente &raquo;</a></td>
    </tr>
</table>

<table id="container">
    <tr>
        <td id="design">

            <a href=<?=$PHP_SELF?>?capitulo=<?php echo "$c_capitulo"?>&c=<?=getNext($_REQUEST['c'], $pics)?>>
            <?
                
if(isset($_REQUEST['c']))
                
showPic($_REQUEST['c'], $pics);
            
?><br>
            <img src="./././images/copyrigth.jpg" width="728">
            </a>
            <script type="text/javascript"><!--
google_ad_client = "ca-pub-6729945899650204";
/* nav */
google_ad_slot = "2797538722";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
        </td>
    </tr>
</table>

<table class="navigation">
    <tr>
        <td class="navLeft"><a href=<?=$_SERVER['PHP_SELF']?>?capitulo=<?php echo "$c_capitulo"?>&c=<?=getPrev($_REQUEST['c'], $pics)?> class="button medium green">&laquo; Anterior</a></td>
        <td class="navRight"><a href=<?=$_SERVER['PHP_SELF']?>?capitulo=<?php echo "$c_capitulo"?>&c=<?=getNext($_REQUEST['c'], $pics)?> class="button medium green">Siguiente &raquo;</a></td>
    </tr>
</table>
<?php 
}
?>
</body>
</html>
disculpa las molestias y agradezco mucho tu ayuda. saludos