php-general Digest 9 Oct 2012 06:30:47 -0000 Issue 7998
Topics (messages 319387 through 319388):
limiting
319387 by: David McGlone
319388 by: marco.behnke.biz
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Hi all,
is there any other way to limit this code to only displaying 1 image other
than using return. When I use return, I can't get the other images to display
in lightbox, but when I use echo, all 5 of the images will correctly display
in lightbox, but they are also displaying on the page.
$result = mysql_query("SELECT * FROM properties");
$row = mysql_fetch_array($result);
$matches = glob('images/property_pics/212006966/' .$prefix. '*');
foreach($matches as $match){
echo "<a href=$match rel='lightbox[$matches]' /><img src =
$match></a>";
I'm not even sure if this is possible, but thought I'd ask before I scrapped
the idea. I've been at this code since last thursday trying to learn as much
as I can about it and I just keep going in circles and I'm starting to feel
like glob() is what is limiting me. I've tried various code blocks with things
like where(), str_repeat, basename, scandir, sort etc with no luck. :-/
--
David M.
--- End Message ---
--- Begin Message ---
David McGlone <da...@dmcentral.net> hat am 9. Oktober 2012 um 05:11 geschrieben:
> Hi all,
>
> is there any other way to limit this code to only displaying 1 image other
> than using return. When I use return, I can't get the other images to display
> in lightbox, but when I use echo, all 5 of the images will correctly display
> in lightbox, but they are also displaying on the page.
>
> $result = mysql_query("SELECT * FROM properties");
> $row = mysql_fetch_array($result);
> $matches = glob('images/property_pics/212006966/' .$prefix. '*');
> foreach($matches as $match){
> echo "<a href=$match rel='lightbox[$matches]' /><img src =
> $match></a>";
>
> I'm not even sure if this is possible, but thought I'd ask before I scrapped
> the idea. I've been at this code since last thursday trying to learn as much
> as I can about it and I just keep going in circles and I'm starting to feel
> like glob() is what is limiting me. I've tried various code blocks with things
> like where(), str_repeat, basename, scandir, sort etc with no luck. :-/
>
This is less a PHP question but more a question about your html and javascript
code.
Please supply as bit more information about your page and were which images
should go.
Without seeing what you are doing I would think that you must collect the images
in an array that is used to print out the images on the page at two different
locations. Something like:
$result = mysql_query("SELECT * FROM properties");
$row = mysql_fetch_array($result);
$matches = glob('images/property_pics/212006966/' .$prefix. '*');
$images = array();
foreach ($matches as $match) {
$images[] = "<a href='$match' rel='lightbox[$matches]' /><img src
='$match'></a>";
}
// print only first image
echo $image[0];
// print all images
foreach ($images as $image) {
echo $image;
}
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3
Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz
Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal
http://www.behnke.biz
--- End Message ---