PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Escaped has become is_file
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Escaped has become is_file

Réponse
 
LinkBack Outils de la discussion
Vieux 12/09/2007, 06h37   #1
Confused but working on it
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Escaped has become is_file

Thanks for the with escaping that line. My gallery works great.
Just lines up the pictures and if you resize they move with it instead
of using tables. Added a class to pad each image and looks pretty
clean. The code:
<?php
//Open images directory
$dir = opendir("images");
//List files in images directory
while (($file = readdir($dir)) !== false)
{
echo "<img src='images/$file' class=\"pad1em\">";
}
closedir($dir);
?>

Actually going to replace images with thumbs and make the thumbs link
out to an image. But not until I get rid of the . and .. image holders.

I've been reading the manual and have been trying to replace the
readdir with is_file with mixed results, none good.
while (($file = is_file($dir)) !== false)
Replacing readdir with is_file straight just gave me the page with no
images or image markers.
while (($file = is_file($dir)) !== true)
Then I left as is and changed the false to true and the page took
about 20 seconds and then I stopped it and ended up with thousands of ?
image markers or place holders or whatever they are called.
while (($file = is_file($dir)) == true)
This gave me my full pages but no images or markers.

At this point I think it's clear I'm lost. And tired.
Seems to me that if $file is a dir then it tries again in the while statement.
Then it should hit the .. directory and try again.
Now it should hit a real file and do what is inside of the {}.
Rinse and repeat. Somehow made an infinite loop.
So the original readdir keeps going until it tests as false. Maybe i
need a while inside of a while but maybe an easier way.

Thanks for any .

<snooze>

  Réponse avec citation
Vieux 12/09/2007, 13h11   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Escaped has become is_file

Confused but working on it wrote:
> Thanks for the with escaping that line. My gallery works great.
> Just lines up the pictures and if you resize they move with it instead
> of using tables. Added a class to pad each image and looks pretty clean.
> The code:
> <?php
> //Open images directory
> $dir = opendir("images");
> //List files in images directory
> while (($file = readdir($dir)) !== false)
> {
> echo "<img src='images/$file' class=\"pad1em\">";
> }
> closedir($dir);
> ?>
>
> Actually going to replace images with thumbs and make the thumbs link
> out to an image. But not until I get rid of the . and .. image holders.
>
> I've been reading the manual and have been trying to replace the readdir
> with is_file with mixed results, none good.
> while (($file = is_file($dir)) !== false)
> Replacing readdir with is_file straight just gave me the page with no
> images or image markers.
> while (($file = is_file($dir)) !== true)
> Then I left as is and changed the false to true and the page took about
> 20 seconds and then I stopped it and ended up with thousands of ? image
> markers or place holders or whatever they are called.
> while (($file = is_file($dir)) == true)
> This gave me my full pages but no images or markers.
>
> At this point I think it's clear I'm lost. And tired.
> Seems to me that if $file is a dir then it tries again in the while
> statement.
> Then it should hit the .. directory and try again.
> Now it should hit a real file and do what is inside of the {}.
> Rinse and repeat. Somehow made an infinite loop.
> So the original readdir keeps going until it tests as false. Maybe i
> need a while inside of a while but maybe an easier way.
>
> Thanks for any .
>
> <snooze>
>


You can't replace the readdir() call - that's what fetches the next
directory entry. is_file() is something completely different.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  Réponse avec citation
Vieux 12/09/2007, 15h47   #3
Confused but working on it
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Escaped has become is_file

On 2007-09-12 05:11:01 -0700, Jerry Stuckle <jstucklex@attglobal.net> said:
>> Thanks for any .
>>
>> <snooze>
>>

>
> You can't replace the readdir() call - that's what fetches the next
> directory entry. is_file() is something completely different.


This is what I finished with last night:"
<?php
//Open images directory
$dir = opendir("images");
//List files in images directory
while (($file = readdir($dir)) !== false)
{
while (($file = is_file($dir)) == true)
{
echo "<img src='images/$file' class=\"pad1em\">";
}
}
closedir($dir);
?>

Doesn't displa my images but doesnt break eaither. Going to just trying
to match .jpg before gopine to the echo...

Thx for your

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h30.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09252 seconds with 11 queries