Ver Mensaje Individual
  #8 (permalink)  
Antiguo 02/03/2012, 09:44
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

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.