Page 1 of 1

Outputing a directory >> Small problem

Posted: Wed Jul 06, 2005 12:12 am
by HxJ
Hi!

I'm trying to configure this code that outputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gt;&quote;;
         }

      }

      closedir($handle);

   }

?&gt;
This still outputs:

>> .
>> ..
>&am($file = readdir($handle))) {

if($file != "." || $file != "..") { // for some reason, this has no affect.

echo &quote;
&lt;tr&gt;
&lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
&lt;/tr&utputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != &quote;.&quote; || $file != "..") { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != &quote;.&quote; || $file != &quote;..&quote;) { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gtto configure this code that outputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != &quote;.&quote; || $file != &quote;..&quote;) { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gt;&quote;;
         }

      }

to configure this code that outputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != &quote;.&quote; || $file != &quote;..&quote;) { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gt;&quote;;
         }

      }

      closedir($handle);

   }

?&gt;[/php:1:591f the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.tputs, "." and ".."

Code: Select all

<?

   $dir = &quote;../files/&quote;;

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amcode that outputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

&lt;?

   $dir = &quote;../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != &quote;.&quote; || $file != &quote;..&quote;) { // for some reason, this has no affect.

            echo "
                  &lt;tr&gt;
                     &lt;td&gt;<a href=\"$dir"."$file\">&nbsp;&raquo; $file</a>&ammp;quote;." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.tory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks. if($file != "." || $file != "..") { // for some reason, this has no affect.

echo "
<tr>
<td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
</tr>";
}

}

closedir($handle);

}

?>

This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still ousome trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
&ato configure this code that outputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.m having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of tes/";

if($handle = opendir($dir)) {

while(false !== ($file = readdir($handle))) {

if($file != "." || $file != "..") { // for some reason, this has no affect.

echo "
<tr>
<td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
</tr>";
}

}

closedir($handle);

}

?>

This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.to configure this code that outputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != &quote;.&quote; || $file != &quote;..&quote;) { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;>&nbsp;&raquo; $file&amutputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/&quote;;

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != &quote;.&quote; || $file != &quote;..&quote;) { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gt;&quote;;
         }

      }

      closedir($handle);

   }

?&gt;
This still outputs:

>> .
>> ..
>> file01.jpg
the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> filerst lines it outputs, "." and ".."

Code: Select all

&lt;?

   $dir = &quote;../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != &quote;.&quote; || $file != &quote;..&quote;) { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&ato configure this code that outputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != &quote;.&quote; || $file != &quote;..&quote;) { // for some reason, this has no affect.

            echo &quote;
                  &lt;tr&gt;
                     &lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gt;&quote;;
         }

      }

      closedir($handle);

   }

?&gt;
This still outputs:

>> .
>> ..
>> file01.jpg
&amp

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.($dir)) {

while(false !== ($file = readdir($handle))) {

if($file != "." || $file != "..") { // for some reason, this has no affect.

echo "
&lt;tr&gt;
&lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;&quote;;
}

}

closedir($handle);

}

?&gt;

This still outputs:

>> .
>> ..
>> file01.jpg
>> fifor some reason, this has no affect.

echo "
<tr>
<td><a href=\"$dir"."$ctory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.;

if($handle = opendir($dir)) {

while(false !== ($file = readdir($handle))) {

if($file != &quote;.&quote; || $file != &quote;..&quote;) { // for some reason, this has no affect.

echo &quote;
&lt;tr&gt;
&lt;td&gt;&lt;a href=\&quote;$dir&quote;.&quote;$file\&quote;&gt;&amp;nbsp;&amp;raquo; $file&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;&quote;;
}

}

closedir($handle);

}

?puts a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.s, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>&outputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and to configure this code that outputs a directory.
But I'm having some trouble getting rid of the two first lines it outputs, "." and ".."

Code: Select all

<?

   $dir = "../files/";

   if($handle = opendir($dir)) {

      while(false !== ($file = readdir($handle))) {

         if($file != "." || $file != "..") { // for some reason, this has no affect.

            echo "
                  <tr>
                     <td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
                  </tr>";
         }

      }

      closedir($handle);

   }

?>
This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.te;;

if($handle = opendir($dir)) {

while(false !== ($file = readdir($handle))) {

if($file != "." || $file != "..") { // for some reason, this has no affect.

echo "
<tr>
<td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
</tr>";
}

}

closedir($handle);

}

?>

This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.e(false !== ($file = readdir($handle))) {

if($file != "." || $file != "..") { // for some reason, this has no affect.

echo "
<tr>
<td><a href=\"$dir".&quote;$file\&quote;&am<?

$dir = "../files/";

if($handle = opendir($dir)) {

while(false !== ($file = readdir($handle))) {

if($file != "." || $file != "..") { // for some reason, this has no affect.

echo "
<tr>
<td><a href=\"$dir"."$file\">&nbsp;&raquo; $file</a></td>
</tr>";
}

}

closedir($handle);

}

?>

This still outputs:

>> .
>> ..
>> file01.jpg
>> file02.exe

Any suggestions on how to fix this? getting rid of the "." and ".."?

Thanks.

Posted: Wed Jul 06, 2005 12:36 am
by smo
Replace || with and inside the if condition.

Posted: Wed Jul 06, 2005 1:59 pm
by HxJ
Thank you so much! :D

Love