Re: [PHP-ES] dudas con una galer ía

[email protected] (Carlos López)
Newsgroups php.general.es
Message-ID <0AAA6F573E7B44C2ABFCAE2D301639BD@carlosPC>
Hola, tal como yo lo veo se puede hacer de varias maneras:

    1. Si colocas la foto grande en un iframe, puedes enviar el enlace desde 
el atributo "<a href="foto1" target="nombre_iframe">, de este modo y con 
CSS, cada vez que haces click en la miniatura, se establecera la 
clase"active" para el enlace de forma predeterminada, siendo la clase active 
con CSS algún borde o algo así..

    2. Lanzando la foto grande a través del enlace simplemente haces una 
comprobación de si coincide con el id o nombre de la miniatura en cuyo caso 
le metes la clase CSS que quieras:

            miniatura:
            <a href="fotogrande.php?foto=3" <?php if ($_GET('foto') ==3) { 
echo class = 'seleccionada'; } ?> <img....>

o con tu codigo:

<a href="$_SERVER['PHP_SELF']?foto=$foto3" title="ver foto"  <?php if 
($_GET('foto') ==$foto3) { echo class = 'seleccionada'; } ?> ><img.....>

No se si es muy correcto que todas tus miniaturas tengan el mismo 
id='foto'...

Saludos
Carlos
--------------------------------------------------
From: <[email protected]>
Sent: Thursday, August 19, 2010 10:22 AM
To: <[email protected]>
Subject: [PHP-ES] dudas con una galería

> Hola amigos, tengo una galería de fotos y necesito que cuando la se vea la
> foto grande, la correspondiente en pequeño tenga una clase activa. No se
> como llegar con un valor para comparar si la pequeña pulsada y la grande
> son las mismas. Seguro que alguien puede ayudarme y de antemano gracias.
>
> Les adjunto el código correspondiente.
>
> <div id="gallery">
> <?
> if ($foto1!='')
> {
> ?>
> <img id="foto" class="left" src="imagenes/inmuebles/<? echo
> "$foto1" ?>" alt="<? echo "$ref" ?>" width="632" height="450"/>
> <?
>                        }
> else
> {
> ?>
>                        <img src="imagenes/inmuebles/thumb_nofoto.gif"
> alt="<? echo "$ref" ?>" width="632" height="450"/>
> <?
>                        }
> ?>
>                        <ul class="lst_visor">
>                        <?
>                        if ($foto1!='')
> {
> ?>
> <li class="active"><a href="#" title="ver foto"><img id="foto"
> src="imagenes/inmuebles/<? echo "$foto1" ?>" alt="ver foto" width="125"
> height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> else
> {
> ?>
>                        <li class="active"><a href="#" title="ver
> foto"><img id="foto" src="imagenes/inmuebles/thumb_nofoto.gif" alt="ver
> foto" width="125" height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> if ($foto2!='')
> {
> ?>
> <li class="active"><a href="#" title="ver foto"><img id="foto"
> src="imagenes/inmuebles/<? echo "$foto2" ?>" alt="ver foto" width="125"
> height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> else
> {
> ?>
>                        <li class="active"><a href="#" title="ver
> foto"><img id="foto" src="imagenes/inmuebles/thumb_nofoto.gif" alt="ver
> foto" width="125" height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> if ($foto3!='')
> {
> ?>
> <li class="active"><a href="#" title="ver foto"><img id="foto"
> src="imagenes/inmuebles/<? echo "$foto3" ?>" alt="ver foto" width="125"
> height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> else
> {
> ?>
>                        <li class="active"><a href="#" title="ver
> foto"><img id="foto" src="imagenes/inmuebles/thumb_nofoto.gif" alt="ver
> foto" width="125" height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> if ($foto4!='')
> {
> ?>
> <li class="active"><a href="#" title="ver foto"><img id="foto"
> src="imagenes/inmuebles/<? echo "$foto4" ?>" alt="ver foto" width="125"
> height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> else
> {
> ?>
>                        <li class="active"><a href="#" title="ver
> foto"><img id="foto" src="imagenes/inmuebles/thumb_nofoto.gif" alt="ver
> foto" width="125" height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> if ($foto5!='')
> {
> ?>
> <li class="active"><a href="#" title="ver foto"><img id="foto"
> src="imagenes/inmuebles/<? echo "$foto5" ?>" alt="ver foto" width="125"
> height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> else
> {
> ?>
>                        <li class="active"><a href="#" title="ver
> foto"><img id="foto" src="imagenes/inmuebles/thumb_nofoto.gif" alt="ver
> foto" width="125" height="90"
> onclick="document.getElementById('foto').src=this.src"/></a></li>
> <?
>                        }
> ?>
>
>                        </ul>
>                     </div>
>
> -- 
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.