Foros del Web » Programando para Internet » PHP »

modificar funcion anterior siguiente

Estas en el tema de modificar funcion anterior siguiente en el foro de PHP en Foros del Web. Buenas estimados quisiera saber si podrian ayudarme con el siguiente problema tengo las siguientes funciones que son de una galeria pero quisiera saber si podrian ...
  #1 (permalink)  
Antiguo 28/02/2012, 13:01
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
modificar funcion anterior siguiente

Buenas estimados quisiera saber si podrian ayudarme con el siguiente problema

tengo las siguientes funciones que son de una galeria pero quisiera saber si podrian ayudarme a que cuando sea la primera imagen no pueda ver ninguna imagen anterior y cuando sea la ultima no regrese a la primera o que de preferencia me mande a otra pagina que yo quiera. discúlpenme ya que no se como modificarlo para lograr esas modificaciones que menciono , si pudieran ayudarme les estaria agradecido.

Código PHP:
function getPrev($c$pics)
{
    
$len count($pics);
    
$ret 0;
    if(
$len 1)
    {
        if(
$c == 0)
            
$ret $len 1;
        else
            
$ret $c 1;
    }
    else
    {
        
$ret 0;
    }
    return 
$ret;
}

function 
getNext($c$pics)
{
    
$len count($pics);
    
$ret 0;
    if(
$len 1)
    {
        if(
$c == $len -1)
            
$ret 0;
        else
            
$ret $c 1;
    }
    else
    {
        
$ret $c;
    }
    return 
$ret;

  #2 (permalink)  
Antiguo 29/02/2012, 02:08
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: modificar funcion anterior siguiente

Código PHP:
Ver original
  1. function getPrev($c, $pics)
  2. {
  3.     if(1 == $c) return "<<";
  4.     if($c <= count($pics)) return $c - 1;
  5.     elseif($c == count($pics)) return $c;
  6. }
  7.  
  8. function getNext($c, $pics)
  9. {
  10.     if($c < count($pics)) return $c + 1;
  11.     elseif($c == count($pics)) return ">>";
  12. }
__________________
Fere libenter homines, id quod volunt, credunt.
  #3 (permalink)  
Antiguo 29/02/2012, 10:09
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

Disculpa repara2 pero no me funciono te muestro el codigo de la galeria

Código:
<?php 
$direct ="".$reg['c_path']."";// picviewer.php 
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='".$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(1 == $c) return "<<";
    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 ">>";
}

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">
		Chose Design: 
		  <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="midominio.com">dominio </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=<?=$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>
<?php 
}
?>
</body>
</html>
  #4 (permalink)  
Antiguo 29/02/2012, 13:34
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: modificar funcion anterior siguiente

No sé de qué manera llamas a este script pero en principio tiene unos cuantos errores. Coloca estas dos lineas al principio del script y ejecútalo:

error_reporting(E_ALL);
ini_set("display_errors", 1);

Una vez que hayas solucionado esto puedes continuar con el tema paginación. El código que te pasé funciona, pero es difícil que lo haga bien dentro de este script. Prueba lo que te digo y vuelve a postear y seguimos desde allí.
__________________
Fere libenter homines, id quod volunt, credunt.
  #5 (permalink)  
Antiguo 01/03/2012, 22:38
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

gracias por la ayuda repara2, hice lo que me dices y agrege el codigo al principio de todo

Código:
<?php 
error_reporting(E_ALL);
ini_set("display_errors", 1);
session_start();
me muestra la primera imagen bien, al quererle dar atras cuando es la primera imagen es cuando me sale esto

Código:
Notice: Undefined index: -1 in /home/manga13/public_html/galeria2.php on line 69
Notice: Undefined variable: PHP_SELF in /home/manga13/public_html/galeria2.php on line 400
?capitulo=1&c=-2 class="button medium green">« Anterior
Código:
Notice: Undefined index: -1 in /home/manga13/public_html/galeria2.php on line 49
Código:
Notice: Undefined variable: PHP_SELF in /home/manga13/public_html/galeria2.php on line 433
?capitulo=1&c=-2 class="button medium green">« Anterior
  #6 (permalink)  
Antiguo 01/03/2012, 22:44
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

por si sirve de algo asi es como lo muestra la galeria

Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <br><meta name='Keywords' content='Nuevo proyecto, mas información en nuestra web. Reclutamos Typesetters '/><br><meta name='Description' content='Nuevo proyecto, mas información en nuestra web. Reclutamos Typesetters '/><title>dominio.net</title>
  6.  
  7.  
  8. <style type="text/css">
  9.  
  10. body {
  11.     background: #26172D;
  12.     font: 11px/16px arial, helvetica, sans-serif;
  13.     color: #363333;
  14.     margin: 0;
  15.     padding: 0;
  16.     }
  17. table, tr, td {
  18.     font: 11px/16px arial, helvetica, sans-serif;
  19.     color: #cccccc;
  20.     border-collapse: collapse;
  21.     border: none;
  22.     margin: 0;
  23.     padding: 0;
  24.     }
  25.    
  26. #header { background-color:#0182a7;
  27.  
  28.  }
  29.  
  30. #title {
  31.     font-size: 12px;
  32.     color: #fff;
  33.     padding: 12px;
  34.    
  35.     }
  36.     #title a {
  37.     color: #fff;
  38.     text-decoration: none;
  39.    
  40.     }
  41.     #title a:hover {
  42.     color: #abdb30;
  43.     text-decoration: none;
  44.    
  45.     }
  46. #dropdownNav {
  47.     background: #E8F8FF;
  48.     float: right;
  49.     font-weight: bold;
  50.     color: #000000;
  51.     border-left: 1px solid #cccccc;
  52.     padding: 10px 30px 12px 30px;
  53.     }
  54.    
  55. .navigation {
  56.     background: #cccccc;
  57.     border-top: 2px solid #b6b6b6;
  58.     border-bottom: 2px solid #b6b6b6;
  59.     width: 100%;
  60.     }
  61. .navLeft {
  62.     text-align: left;
  63.     padding: 10px 20px;
  64.     width: 50%;
  65.     font-weight: bold;
  66.     font-size: 12px;
  67.     }
  68. .navRight {
  69.     text-align: right;
  70.     padding: 10px 20px;
  71.     width: 50%;
  72.     font-weight: bold;
  73.     font-size: 12px;
  74.     }
  75.  
  76. #container {
  77.     background: #fff;
  78.     margin: 0;
  79.     padding: 0;
  80.     width: 100%;
  81.         }
  82. #index {
  83.     background: #e7e7e7;
  84.     vertical-align: top;
  85.     padding: 0;
  86.     border-right: 1px dashed #d7dee2;
  87.     white-space: nowrap;
  88.     width: 200px;
  89.     }
  90. #index ul {
  91.     margin: 0;
  92.     padding: 0;
  93.     }
  94. #index ul li {
  95.     list-style: none;
  96.     font-weight: bold;
  97.     border-bottom: 1px dashed #d5d5d5;
  98.     }
  99.    
  100. #design {
  101.     vertical-align: top;
  102.     padding: 20px;
  103.     text-align: center;
  104.     }
  105.    
  106. p, h1 { margin-top: 0; }
  107.  
  108. a:link, a:active, a:visited {
  109.     color: #004f86;
  110.     text-decoration: none;
  111.     }
  112. a:hover {
  113.     color: #0072c1;
  114.     text-decoration: none;
  115.     }
  116.  
  117. .navigation a:link, .navigation a:active, .navigation a:visited {
  118.     color: #fff;
  119.     text-decoration: none;
  120.     }
  121. .navigation a:hover {
  122.     color: #ddd;
  123.     text-decoration: none;
  124.     }
  125.    
  126. #index a:link, #index a:active, #index a:visited {
  127.     background: #f3f3f3;
  128.     text-decoration: none;
  129.     padding: 5px 10px;
  130.     display: block;
  131.     }
  132.  
  133. #index a:hover {
  134.     background: #f9f9f9;
  135.     text-decoration: none;
  136.     padding: 5px 10px;
  137.     display: block;
  138.     }
  139.    
  140. img { border: none; }
  141.  
  142. #design img {
  143.     padding: 4px;
  144.     border: 1px dashed #d7dee2;
  145.     }
  146.    
  147. #footer {
  148.     padding: 20px;
  149.     color: #858585;
  150.     font-size: 11px;
  151.     }
  152. #footer a:link, #footer a:active, #footer a:visited {
  153.     color: #858585;
  154.     text-decoration: none;
  155.     }
  156. #footer a:hover { color: #a1a1a1;}
  157.  
  158. form {
  159.     margin: 0;
  160.     padding: 0;
  161.     }
  162. select {
  163.     font: 11px/16px arial, helvetica, sans-serif;
  164.     color: #363333;
  165.     margin: 0 0 0 5px;
  166.     padding: 0;
  167.     }
  168.     /* --------------- BOTONES --------------- */
  169.  
  170. .button, .button:visited { /* botones genéricos */
  171. background: #222 url(http://sites.google.com/site/zavaletaster/Home/overlay.png) repeat-x;
  172. display: inline-block;
  173. padding: 5px 10px 6px;
  174. color: #FFF;
  175. text-decoration: none;
  176. -moz-border-radius: 6px;
  177. -webkit-border-radius: 6px;
  178. -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
  179. -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
  180. text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
  181. border-top: 0px;
  182. border-left: 0px;
  183. border-right: 0px;
  184. border-bottom: 1px solid rgba(0,0,0,0.25);
  185. position: relative;
  186. cursor:pointer;
  187. }
  188.  
  189. button::-moz-focus-inner,
  190. input[type="reset"]::-moz-focus-inner,
  191. input[type="button"]::-moz-focus-inner,
  192. input[type="submit"]::-moz-focus-inner,
  193. input[type="file"] > input[type="button"]::-moz-focus-inner {
  194. border: none;
  195. }
  196.  
  197. .button:hover { /* el efecto hover */
  198. background-color: #111
  199. color: #FFF;
  200. }
  201.  
  202. .button:active{ /* el efecto click */
  203. top: 1px;
  204. }
  205.  
  206. /* botones pequeños */
  207. .small.button, .small.button:visited {
  208. font-size: 11px ;
  209. }
  210.  
  211. /* botones medianos */
  212. .button, .button:visited,.medium.button, .medium.button:visited {
  213. font-size: 13px;
  214. font-weight: bold;
  215. line-height: 1;
  216. text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
  217. }
  218.  
  219. /* botones grandes */
  220. .large.button, .large.button:visited {
  221. font-size:14px;
  222. padding: 8px 14px 9px;
  223. }
  224.  
  225. /* botones extra grandes */
  226. .super.button, .super.button:visited {
  227. font-size: 34px;
  228. padding: 8px 14px 9px;
  229. }
  230.  
  231. .pink.button { background-color: #E22092; }
  232. .pink.button:hover{ background-color: #C81E82; }
  233.  
  234. .green.button, .green.button:visited { background-color: #91BD09; }
  235. .green.button:hover{ background-color: #749A02; }
  236.  
  237. .red.button, .red.button:visited { background-color: #E62727; }
  238. .red.button:hover{ background-color: #CF2525; }
  239.  
  240. .orange.button, .orange.button:visited { background-color: #FF5C00; }
  241. .orange.button:hover{ background-color: #D45500; }
  242.  
  243. .blue.button, .blue.button:visited { background-color: #2981E4; }
  244. .blue.button:hover{ background-color: #2575CF; }
  245.  
  246. .yellow.button, .yellow.button:visited { background-color: #FFB515; }
  247. .yellow.button:hover{ background-color: #FC9200; }
  248.    
  249. </style>
  250.  
  251. <script language="JavaScript">
  252. <!--
  253. function MM_jumpMenu(targ,selObj,restore){ //v3.0
  254.   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  255.   if (restore) selObj.selectedIndex=0;
  256. }
  257. //-->
  258. </script>
  259.  
  260.  
  261. </head>
  262.  
  263. <body>
  264.  
  265. <div id="header">
  266.  
  267.     <div id="dropdownNav">
  268.         <form name="menu">
  269.         Chose Design:
  270.           <select name="jumpMenu" onChange="MM_jumpMenu('parent',this,0)">
  271.             <option>VK47-01</option>
  272.             <br />
  273. <b>Notice</b>:  Undefined variable: PHP_SELF in <b>/home/manga13/public_html/galeria2.php</b> on line <b>42</b><br />
  274. <option value='?capitulo=1&c=0'>VK47-01</option>
  275. <option value='?capitulo=1&c=1'>VK47-02</option>
  276. <option value='?capitulo=1&c=2'>VK47-03</option>
  277. <option value='?capitulo=1&c=3'>VK47-04</option>
  278. <option value='?capitulo=1&c=4'>VK47-05</option>
  279. <option value='?capitulo=1&c=5'>VK47-06</option>
  280. <option value='?capitulo=1&c=6'>VK47-08</option>
  281. <option value='?capitulo=1&c=7'>VK47-10</option>
  282. <option value='?capitulo=1&c=8'>VK47-11</option>
  283. <option value='?capitulo=1&c=9'>VK47-13</option>
  284.           </select>
  285.         </form>
  286.     </div>
  287.  
  288.     <div id="title">Galeria<a href="index.php?sec=capitulos&serie=Maga-Tsuki">Maga-Tsuki</a> / 1 / VK47-01</div>
  289.    
  290. </div>
  291.  
  292. <table class="navigation">
  293.     <tr>
  294.         <td class="navLeft"><a href=?capitulo=1&c=-1 class="button medium green">&laquo; Anterior</a></td>
  295.         <td class="navRight"><a href=?capitulo=1&c=1 class="button medium green">Siguiente &raquo;</a></td>
  296.     </tr>
  297. </table>
  298.  
  299. <table id="container">
  300.     <tr>
  301.         <td id="design">
  302.  
  303.             <a href=?capitulo=1&c=1>
  304.             <!-- 0 -->
  305. <img src="c/prueba/prueba/1/5911//VK47-01.jpg" width=728'><br>
  306.             <img src="./././images/copyrigth.jpg" width="728">
  307.             </a>
  308.             <script type="text/javascript"><!--
  309. google_ad_client = "ca-pub-6729945899650204";
  310. /* nav */
  311. google_ad_slot = "2797538722";
  312. google_ad_width = 728;
  313. google_ad_height = 90;
  314. //-->
  315. </script>
  316. <script type="text/javascript"
  317. src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  318. </script>
  319.         </td>
  320.     </tr>
  321. </table>
  322.  
  323. <table class="navigation">
  324.     <tr>
  325.         <td class="navLeft"><a href=?capitulo=1&c=-1 class="button medium green">&laquo; Anterior</a></td>
  326.         <td class="navRight"><a href=?capitulo=1&c=1 class="button medium green">Siguiente &raquo;</a></td>
  327.     </tr>
  328. </table>
  329. </body>
  330. </html>
  #7 (permalink)  
Antiguo 02/03/2012, 00:40
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: modificar funcion anterior siguiente

Undefined variable: PHP_SELF debes utilizar $_SERVER['PHP_SELF']
Notice: Undefined index: -1 Por algún motivo, $c toma el valor -1. Al querer acceder a la imagen -1, te da el error:

<a href=?capitulo=1&c=-1

no veo el archivo galeria2.php, pero el tema es simple, cuando estás en la imagen 1, no hay elemento anterior. Entonces $c debe valer 1. Utiliza un if para forzar el valor de $c aunque esto debería salir de las funciones de anterior y siguiente.
__________________
Fere libenter homines, id quod volunt, credunt.
  #8 (permalink)  
Antiguo 02/03/2012, 09:44
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

Gracias por tu respuesta repara2, y disculpa mi ignorancia en esto tengo problemas en saber donde modificarlo

este es el codigo de galeria2.php

Código PHP:
Ver original
  1. <?php
  2. $direct ="".$reg['c_path']."";// picviewer.php
  3. function loadPics($pics)
  4.  
  5. {
  6.  global $direct;
  7.     if ($dir = @opendir("$direct/"))
  8.     {
  9.         while($file = readdir($dir))
  10.         {
  11.             if(preg_match("/\.jpg$|\.gif$|\.png$/", $file))
  12.                 array_push($pics, $file);
  13.         }  
  14.        
  15.         closedir($dir);
  16.     }
  17.    
  18.     sort($pics);
  19.     return $pics;
  20. }
  21.  
  22. function listPics($pics)
  23. {
  24.     while(list($num, $pic) = each($pics))
  25.     {
  26.     global $c_capitulo;
  27.         echo "<option value='".$PHP_SELF."?capitulo=$c_capitulo&c=$num'>".getPicName($num, $pics)."</option>\n";
  28.     }
  29. }
  30.  
  31. function showPic($c, $pics)
  32. {
  33. global $direct;
  34.     $pic = $pics[$c];
  35.     echo "<!-- $c -->\n";
  36.     echo "<img src=\"$direct/$pic\" width=728'>";
  37. }
  38.  
  39. function getPrev($c, $pics)
  40. {
  41.     if(1 == $c) return "<<";
  42.     if($c <= count($pics)) return $c - 1;
  43.     elseif($c == count($pics)) return $c;
  44. }
  45.  
  46. function getNext($c, $pics)
  47. {
  48.     if($c < count($pics)) return $c + 1;
  49.     elseif($c == count($pics)) return ">>";
  50. }
  51.  
  52. function getPicName($c, $pics)
  53. {
  54.     return preg_replace("/\.jpg$|\.gif$|\.png$/i", "", $pics[$c]);
  55. }
  56.  
  57. $pics = array();
  58. $pics = loadPics($pics);
  59.  
  60. if(!isset($_REQUEST['c'])) $_REQUEST['c'] = 0;
  61.  
  62. ?>
  63.  
  64.  
  65. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  66. <html xmlns="http://www.w3.org/1999/xhtml">
  67. <head>
  68. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  69. <title>manganix.net / <?php echo "".$reg['s_serie']."-".$reg['c_capitulo'].""; ?> pagina:"<?=getPicName($_REQUEST['c'], $pics)?>"</title>
  70.  
  71.  
  72. <style type="text/css">
  73.  
  74. body {
  75.     background: #26172D;
  76.     font: 11px/16px arial, helvetica, sans-serif;
  77.     color: #363333;
  78.     margin: 0;
  79.     padding: 0;
  80.     }
  81. table, tr, td {
  82.     font: 11px/16px arial, helvetica, sans-serif;
  83.     color: #cccccc;
  84.     border-collapse: collapse;
  85.     border: none;
  86.     margin: 0;
  87.     padding: 0;
  88.     }
  89.    
  90. #header { background-color:#0182a7;
  91.  
  92.  }
  93.  
  94. #title {
  95.     font-size: 12px;
  96.     color: #fff;
  97.     padding: 12px;
  98.    
  99.     }
  100.     #title a {
  101.     color: #fff;
  102.     text-decoration: none;
  103.    
  104.     }
  105.     #title a:hover {
  106.     color: #abdb30;
  107.     text-decoration: none;
  108.    
  109.     }
  110. #dropdownNav {
  111.     background: #E8F8FF;
  112.     float: right;
  113.     font-weight: bold;
  114.     color: #000000;
  115.     border-left: 1px solid #cccccc;
  116.     padding: 10px 30px 12px 30px;
  117.     }
  118.    
  119. .navigation {
  120.     background: #cccccc;
  121.     border-top: 2px solid #b6b6b6;
  122.     border-bottom: 2px solid #b6b6b6;
  123.     width: 100%;
  124.     }
  125. .navLeft {
  126.     text-align: left;
  127.     padding: 10px 20px;
  128.     width: 50%;
  129.     font-weight: bold;
  130.     font-size: 12px;
  131.     }
  132. .navRight {
  133.     text-align: right;
  134.     padding: 10px 20px;
  135.     width: 50%;
  136.     font-weight: bold;
  137.     font-size: 12px;
  138.     }
  139.  
  140. #container {
  141.     background: #fff;
  142.     margin: 0;
  143.     padding: 0;
  144.     width: 100%;
  145.         }
  146. #index {
  147.     background: #e7e7e7;
  148.     vertical-align: top;
  149.     padding: 0;
  150.     border-right: 1px dashed #d7dee2;
  151.     white-space: nowrap;
  152.     width: 200px;
  153.     }
  154. #index ul {
  155.     margin: 0;
  156.     padding: 0;
  157.     }
  158. #index ul li {
  159.     list-style: none;
  160.     font-weight: bold;
  161.     border-bottom: 1px dashed #d5d5d5;
  162.     }
  163.    
  164. #design {
  165.     vertical-align: top;
  166.     padding: 20px;
  167.     text-align: center;
  168.     }
  169.    
  170. p, h1 { margin-top: 0; }
  171.  
  172. a:link, a:active, a:visited {
  173.     color: #004f86;
  174.     text-decoration: none;
  175.     }
  176. a:hover {
  177.     color: #0072c1;
  178.     text-decoration: none;
  179.     }
  180.  
  181. .navigation a:link, .navigation a:active, .navigation a:visited {
  182.     color: #fff;
  183.     text-decoration: none;
  184.     }
  185. .navigation a:hover {
  186.     color: #ddd;
  187.     text-decoration: none;
  188.     }
  189.    
  190. #index a:link, #index a:active, #index a:visited {
  191.     background: #f3f3f3;
  192.     text-decoration: none;
  193.     padding: 5px 10px;
  194.     display: block;
  195.     }
  196.  
  197. #index a:hover {
  198.     background: #f9f9f9;
  199.     text-decoration: none;
  200.     padding: 5px 10px;
  201.     display: block;
  202.     }
  203.    
  204. img { border: none; }
  205.  
  206. #design img {
  207.     padding: 4px;
  208.     border: 1px dashed #d7dee2;
  209.     }
  210.    
  211. #footer {
  212.     padding: 20px;
  213.     color: #858585;
  214.     font-size: 11px;
  215.     }
  216. #footer a:link, #footer a:active, #footer a:visited {
  217.     color: #858585;
  218.     text-decoration: none;
  219.     }
  220. #footer a:hover { color: #a1a1a1;}
  221.  
  222. form {
  223.     margin: 0;
  224.     padding: 0;
  225.     }
  226. select {
  227.     font: 11px/16px arial, helvetica, sans-serif;
  228.     color: #363333;
  229.     margin: 0 0 0 5px;
  230.     padding: 0;
  231.     }
  232.     /* --------------- BOTONES --------------- */
  233.  
  234. .button, .button:visited { /* botones genéricos */
  235. background: #222 url(http://sites.google.com/site/zavaletaster/Home/overlay.png) repeat-x;
  236. display: inline-block;
  237. padding: 5px 10px 6px;
  238. color: #FFF;
  239. text-decoration: none;
  240. -moz-border-radius: 6px;
  241. -webkit-border-radius: 6px;
  242. -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
  243. -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
  244. text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
  245. border-top: 0px;
  246. border-left: 0px;
  247. border-right: 0px;
  248. border-bottom: 1px solid rgba(0,0,0,0.25);
  249. position: relative;
  250. cursor:pointer;
  251. }
  252.  
  253. button::-moz-focus-inner,
  254. input[type="reset"]::-moz-focus-inner,
  255. input[type="button"]::-moz-focus-inner,
  256. input[type="submit"]::-moz-focus-inner,
  257. input[type="file"] > input[type="button"]::-moz-focus-inner {
  258. border: none;
  259. }
  260.  
  261. .button:hover { /* el efecto hover */
  262. background-color: #111
  263. color: #FFF;
  264. }
  265.  
  266. .button:active{ /* el efecto click */
  267. top: 1px;
  268. }
  269.  
  270. /* botones pequeños */
  271. .small.button, .small.button:visited {
  272. font-size: 11px ;
  273. }
  274.  
  275. /* botones medianos */
  276. .button, .button:visited,.medium.button, .medium.button:visited {
  277. font-size: 13px;
  278. font-weight: bold;
  279. line-height: 1;
  280. text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
  281. }
  282.  
  283. /* botones grandes */
  284. .large.button, .large.button:visited {
  285. font-size:14px;
  286. padding: 8px 14px 9px;
  287. }
  288.  
  289. /* botones extra grandes */
  290. .super.button, .super.button:visited {
  291. font-size: 34px;
  292. padding: 8px 14px 9px;
  293. }
  294.  
  295. .pink.button { background-color: #E22092; }
  296. .pink.button:hover{ background-color: #C81E82; }
  297.  
  298. .green.button, .green.button:visited { background-color: #91BD09; }
  299. .green.button:hover{ background-color: #749A02; }
  300.  
  301. .red.button, .red.button:visited { background-color: #E62727; }
  302. .red.button:hover{ background-color: #CF2525; }
  303.  
  304. .orange.button, .orange.button:visited { background-color: #FF5C00; }
  305. .orange.button:hover{ background-color: #D45500; }
  306.  
  307. .blue.button, .blue.button:visited { background-color: #2981E4; }
  308. .blue.button:hover{ background-color: #2575CF; }
  309.  
  310. .yellow.button, .yellow.button:visited { background-color: #FFB515; }
  311. .yellow.button:hover{ background-color: #FC9200; }
  312.    
  313. </style>
  314.  
  315. <script language="JavaScript">
  316. <!--
  317. function MM_jumpMenu(targ,selObj,restore){ //v3.0
  318.   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  319.   if (restore) selObj.selectedIndex=0;
  320. }
  321. //-->
  322. </script>
  323.  
  324.  
  325. </head>
  326.  
  327. <body>
  328.  
  329. <div id="header">
  330.  
  331.     <div id="dropdownNav">
  332.         <form name="menu">
  333.         Chose Design:
  334.           <select name="jumpMenu" onChange="MM_jumpMenu('parent',this,0)">
  335.             <option><?=getPicName($_REQUEST['c'], $pics)?></option>
  336.             <? listPics($pics); ?>
  337.           </select>
  338.         </form>
  339.     </div>
  340.  
  341.     <div id="title"><a href="midominio.com">dominio </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>
  342.    
  343. </div>
  344.  
  345. <table class="navigation">
  346.     <tr>
  347.         <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>
  348.         <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>
  349.     </tr>
  350. </table>
  351.  
  352. <table id="container">
  353.     <tr>
  354.         <td id="design">
  355.  
  356.             <a href=<?=$PHP_SELF?>?capitulo=<?php echo "$c_capitulo"; ?>&c=<?=getNext($_REQUEST['c'], $pics)?>>
  357.             <?
  358.                 if(isset($_REQUEST['c']))
  359.                 showPic($_REQUEST['c'], $pics);
  360.             ?><br>
  361.             <img src="./././images/copyrigth.jpg" width="728">
  362.             </a>
  363.             <script type="text/javascript"><!--
  364. google_ad_client = "ca-pub-6729945899650204";
  365. /* nav */
  366. google_ad_slot = "2797538722";
  367. google_ad_width = 728;
  368. google_ad_height = 90;
  369. //-->
  370. </script>
  371. <script type="text/javascript"
  372. src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  373. </script>
  374.         </td>
  375.     </tr>
  376. </table>
  377.  
  378. <table class="navigation">
  379.     <tr>
  380.         <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>
  381.         <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>
  382.     </tr>
  383. </table>
  384. <?php
  385. }
  386. ?>
  387. </body>
  388. </html>

pero no se como arreglar lo que me comebtas disculpa, si pudieras indicarme donde te lo agradeceria

Cita:
Undefined variable: PHP_SELF debes utilizar $_SERVER['PHP_SELF']
Notice: Undefined index: -1 Por algún motivo, $c toma el valor -1. Al querer acceder a la imagen -1, te da el error:

<a href=?capitulo=1&c=-1

no veo el archivo galeria2.php, pero el tema es simple, cuando estás en la imagen 1, no hay elemento anterior. Entonces $c debe valer 1. Utiliza un if para forzar el valor de $c aunque esto debería salir de las funciones de anterior y siguiente.
  #9 (permalink)  
Antiguo 02/03/2012, 12:04
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: modificar funcion anterior siguiente

Línea 27:

Código PHP:
Ver original
  1. echo "<option value='".$PHP_SELF."?capitulo=$c_capitulo&c=$num'>".getPicName($num, $pics)."</option>\n";

debe ser


Código PHP:
Ver original
  1. echo "<option value='".$_SERVER['PHP_SELF']."?capitulo=$c_capitulo&c=$num'>".getPicName($num, $pics)."</option>\n";

reemplazalo en TODOS tus archivos en todas las lineas donde aparezca.
Lo demás me parece que se puede solucionar así:

Código PHP:
Ver original
  1. function getPrev($c, $pics)
  2. {
  3.     if($c<=0) return 1;
  4.     if(1 == $c) return 1;
  5.     if($c <= count($pics)) return $c - 1;
  6.     elseif($c == count($pics)) return $c;
  7. }
  8.  
  9. function getNext($c, $pics)
  10. {
  11.     if($c < count($pics)) return $c + 1;
  12.     elseif($c == count($pics)) return (count($pics)-1);
  13.     elseif($c>count($pics)) return (count($pics)-1);
  14. }

Saludos
__________________
Fere libenter homines, id quod volunt, credunt.
  #10 (permalink)  
Antiguo 02/03/2012, 19:31
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 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
  #11 (permalink)  
Antiguo 03/03/2012, 20:51
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

el problema no podra estar en la forma en que se hace el link de anterior y siguiente

Código PHP:
Ver original
  1. <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>
  2.         <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>
  #12 (permalink)  
Antiguo 03/03/2012, 22:16
Avatar de chwc  
Fecha de Ingreso: julio-2008
Ubicación: Buenos Aires ! :D
Mensajes: 814
Antigüedad: 15 años, 8 meses
Puntos: 103
Respuesta: modificar funcion anterior siguiente

Cita:
Iniciado por mazaku Ver Mensaje
el problema no podra estar en la forma en que se hace el link de anterior y siguiente

Código PHP:
Ver original
  1. <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>
  2.         <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>
podria ser que quede asi:
Código PHP:
Ver original
  1. <td class="navLeft"><a href=<?=$_SERVER['PHP_SELF']?>?capitulo=<?php echo ($c_capitulo-1); ?>&c=<?=getPrev($_REQUEST['c'], $pics)?> class="button medium green">&laquo; Anterior</a></td>
  2.         <td class="navRight"><a href=<?=$_SERVER['PHP_SELF']?>?capitulo=<?php echo ($c_capitulo+1); ?>&c=<?=getNext($_REQUEST['c'], $pics)?> class="button medium green">Siguiente &raquo;</a></td>

saludos
  #13 (permalink)  
Antiguo 03/03/2012, 22:34
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

No funciono ya no se como cambiarle para que deshabilite el boton de anterior al estar en la primera y deshabilitar siguiente al estar en la ultima imagen
  #14 (permalink)  
Antiguo 03/03/2012, 23:46
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

trato de resolverlo asi con unos if para que no me mostrara ni antes de la primera ni despues de la ultima, anexo parte del codigo que estuve probando

Código PHP:
Ver original
  1. <?php
  2. include ('config.php');
  3. if (isset($_REQUEST['c']))
  4.   $inicio=$_REQUEST['c'];
  5. else
  6.   $inicio=0;
  7.  
  8.  
  9. $c_capitulo = $_GET['capitulo']; // Esto recoje los datos de la variable id en la url.
  10. $registros=mysql_query("SELECT * FROM capitulos WHERE c_capitulo='$c_capitulo' limit $inicio,1",  
  11.            $db_link) or
  12.   die("Problemas en el select:".mysql_error());
  13. $impresos=0;
  14. while ($reg=mysql_fetch_array($registros))
  15. {
  16.  
  17.  
  18.  
  19. ?>


Para mostrar los links los muestro de esta forma con los if

Código PHP:
Ver original
  1. <?php
  2.     $impresos++;
  3.     if ($inicio==0)
  4.   echo "<td></td>";
  5. else
  6. {
  7.   $anterior=$inicio-1;
  8.   echo "<td class='navLeft'><a href='galeria2.php?capitulo=$c_capitulo&c="; getPrev($anterior, $pics); echo "class='button medium green'>&laquo; Anterior</a></td> ";
  9. }
  10. if ($impresos==1)
  11. {
  12.   $proximo=$inicio+1;
  13.   echo " <td class='navRight'><a href='galeria2.php?capitulo=$c_capitulo&c=getNext($proximo, $pics)' class='button medium green'>Siguiente &raquo;</a></td>";
  14. }
  15. else
  16.   echo "<td></td>";
  17. ?>

me marca el siguiente problema al ver el codigo fuente ya que no me esta funcionando

Código HTML:
Ver original
  1. <td></td> <td class='navRight'><a href='galeria2.php?capitulo=1234556&c=getNext(1, Array)' class='button medium green'>Siguiente &raquo;</a></td>   </tr>

podrian decirme si asi esta bien para arreglar el problema o de plano ya esta muy hechado a perder y por ahi no es el problema T.T

saludos
  #15 (permalink)  
Antiguo 04/03/2012, 02:17
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: modificar funcion anterior siguiente

Me resulta muy difícil leer el código sin poder ejecutarlo, si quieres me pasas un zip con todo, con tablas y todo y lo pruebo en mi server. Así te podré decir algo, estoy seguro que es un problema de cómo inicializas las variables. Saludos,
__________________
Fere libenter homines, id quod volunt, credunt.
  #16 (permalink)  
Antiguo 06/03/2012, 17:42
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

repara2 te envie la informacion por mensaje privado, saludos y gracias
  #17 (permalink)  
Antiguo 07/03/2012, 13:38
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

asi pongo el link para ver la galeria, con el registro de la bd que puse

Código:
galeria2.php?capitulo=1234556
  #18 (permalink)  
Antiguo 08/03/2012, 00:17
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: modificar funcion anterior siguiente

ok. pero no he podido descargar el código, no está disponible. Saludos
__________________
Fere libenter homines, id quod volunt, credunt.
  #19 (permalink)  
Antiguo 08/03/2012, 10:19
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

ok disculpa me equivoque al poner el link ya esta corregido
  #20 (permalink)  
Antiguo 08/03/2012, 13:11
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: modificar funcion anterior siguiente

Ya lo tengo, en cuanto puedo te digo algo, saludos
__________________
Fere libenter homines, id quod volunt, credunt.
  #21 (permalink)  
Antiguo 15/03/2012, 16:36
Avatar de mazaku  
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: modificar funcion anterior siguiente

disculpa repara2, lograste encontrar alguna solucion al problema de la galeria, saludos y gracias

Etiquetas: funcion, modificar, siguiente, anteriores
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:54.