offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
I surmise you are trying to ask a question with this post and it’s why
the code you posted has a parse error? if you where then it is
probably because you are missing a closing curly brace so if you add
a } before the ?> that should stop the error.
The brace has been added to the code below between the tildes.
HTH
<?php
$dir = "./otherbrochures";
//open dir
if ($opendir = opendir($dir))
{
//read dir
while (($file = readdir($opendir)) !==FALSE)
{
if ($file!="."&&$file!="..")
echo "<img src="$dir/$file" alt="">";
}
}
}
?>
On Jun 23, 2010, at 7:05 PM, Jordan Bradley wrote:
<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") echo ""; } } ?>
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
OK, I lied, there is also an opening brace missing, the correct
‘untested’ code is as follows:
<?php
$dir = "./otherbrochures";
//open dir
if ($opendir = opendir($dir)) {
//read dir
while (($file = readdir($opendir)) !==FALSE) {
if ($file!="."&&$file!="..") {
echo "<img src="$dir/$file" alt="">";
}
}
}
?>
On Jun 23, 2010, at 7:53 PM, Mike B wrote:
I surmise you are trying to ask a question with this post and it’s
why the code you posted has a parse error? if you where then it is
probably because you are missing a closing curly brace so if you add
a } before the ?> that should stop the error.The brace has been added to the code below between the tildes.
HTH
<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") echo "<img src="$dir/$file" alt="">"; } } } ?>On Jun 23, 2010, at 7:05 PM, Jordan Bradley wrote:
<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") echo ""; } } ?>
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
We are getting there, I just noticed that the string that you are
echoing out is not written correctly either, where you have:
echo "<img src="$dir/$file" alt="">";
is written with double quotes in the string you are trying to produce
a string from, there are various ways of writing this correctly, one
of them would be:
echo "<img src="$dir/$file" alt="">";
another could be:
echo '<img src="' . $dir . '/' . $file . '" alt="">"';
which would now make the following code betwenn the tildes to be error
free:
<?php
$dir = "./otherbrochures";
//open dir
if ($opendir = opendir($dir)) {
//read dir
while (($file = readdir($opendir)) !==FALSE) {
if ($file!="." && $file!="..") {
echo "<img src="$dir/$file" alt="">";
// Could also be: echo '<img src="' . $dir . '/' . $file . '" alt="">'";
}
}
}
?>
hopefully not spoken too soon again ![]()
HTH
On Jun 23, 2010, at 7:57 PM, Mike B wrote:
OK, I lied, there is also an opening brace missing, the correct
‘untested’ code is as follows:<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") { echo "<img src="$dir/$file" alt="">"; } } } ?>On Jun 23, 2010, at 7:53 PM, Mike B wrote:
I surmise you are trying to ask a question with this post and it’s
why the code you posted has a parse error? if you where then it is
probably because you are missing a closing curly brace so if you
add a } before the ?> that should stop the error.The brace has been added to the code below between the tildes.
HTH
<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") echo "<img src="$dir/$file" alt="">"; } } } ?>On Jun 23, 2010, at 7:05 PM, Jordan Bradley wrote:
<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") echo ""; } } ?>
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
Take a look at the last line. You need to escape the double quotes inside your echo statement.
Make it like this:
echo "src="$foo"";
Walter
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
Thanks ALOT! It works now. =D
On Jun 23, 2010, at 2:05 PM, Mike B wrote:
We are getting there, I just noticed that the string that you are
echoing out is not written correctly either, where you have:echo "<img src="$dir/$file" alt="">";is written with double quotes in the string you are trying to
produce a string from, there are various ways of writing this
correctly, one of them would be:echo "<img src="$dir/$file" alt="">";another could be:
echo '<img src="' . $dir . '/' . $file . '" alt="">"';which would now make the following code betwenn the tildes to be
error free:<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="." && $file!="..") { echo "<img src="$dir/$file" alt="">"; // Could also be: echo '<img src="' . $dir . '/' . $file . '" alt="">'"; } } } ?>hopefully not spoken too soon again
HTH
On Jun 23, 2010, at 7:57 PM, Mike B wrote:
OK, I lied, there is also an opening brace missing, the correct
‘untested’ code is as follows:<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") { echo "<img src="$dir/$file" alt="">"; } } } ?>On Jun 23, 2010, at 7:53 PM, Mike B wrote:
I surmise you are trying to ask a question with this post and it’s
why the code you posted has a parse error? if you where then it is
probably because you are missing a closing curly brace so if you
add a } before the ?> that should stop the error.The brace has been added to the code below between the tildes.
HTH
<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") echo "<img src="$dir/$file" alt="">"; } } } ?>On Jun 23, 2010, at 7:05 PM, Jordan Bradley wrote:
<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") echo ""; } } ?>
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
At 19:57 +0200 23/6/10, Mike B wrote:
OK, I lied, there is also an opening brace missing, the correct
‘untested’ code is as follows:<?php $dir = "./otherbrochures"; //open dir if ($opendir = opendir($dir)) { //read dir while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!="..") { echo "<img src="$dir/$file" alt="">"; } } } ?>
if ($file!=“.”&&$file!=“…”) echo “”;
is valid. The braces are only needed if there are more than one
statement after the ‘if’.
David
–
David Ledger - Freelance Unix Sysadmin in the UK.
HP-UX specialist of hpUG technical user group (www.hpug.org.uk)
email@hidden
www.ivdcs.co.uk
offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options