Kevin Marks Posted December 6, 2007 Share Posted December 6, 2007 My code is below... <?php include('../settings/settings.php'); ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="/www/css/thumbs.css" type="text/css"> <title> Title <? echo $sitetitle; ?></title> <style type="text/css"> <!-- .style1 { font-family: Arial; color: #CCCCCC; font-size: 14px; } .style2 { font-family: Arial; font-size: 12px; } --> </style> </head> <body style="margin: 0px;"> <table width="100%" height="655" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="333" rowspan="2" align="left" valign="top"><img src="../layoutpictures/model.jpg" width="333" height="600"></td> <td height="82" align="center" valign="middle"><p><img src="../layoutpictures/info.jpg" width="500" height="50"><br> <span class="style1"><a href="../../../../index.html">Back to Homepage</a> | <a href="../../index.php">Back to Girl's Page<br> </a><a href="../photos/medium/Set1.zip">Download .Zip file of images</a></span> </p> </td> </tr> <tr> <td height="525" align="center" valign="middle"> <?php // create an array to hold directory list $results = array(); // create a handler for the directory $handler = opendir($directory); // keep going until all files in directory have been read while ($file = readdir($handler)) { // if $file isn't this directory or its parent, // add it to the results array if ($file != '.' && $file != '..') { $results[] = $file; } } // tidy up: close the handler closedir($handler); ?> <table width="100%"><tr align='center' valign='middle'> <?php foreach ($results as $thumb) { $index = $index + 1; $col= $col +1; if ($col<"6") { echo "<td>"; } else { echo "</tr><tr align='center' valign='middle'><td width='20%'>"; $col = 1; } echo "<a href=\"../galleries/gallery.php?size=medium&index=$index\"><img border='0' src='$urltothumb$thumb'></a>"; echo "</td>\n"; } ?> </table></td> </tr> <tr> <td align="left" valign="top"> </td> <td height="18" align="center" valign="middle"><span class="style2">information </span></td> </tr> <tr> <td colspan="2" align="CENTER" valign="MIDDLE" height="30"> </td> </tr> </table> </body> </html> The images that are being read in the array are in need of being sorted. the readdir() function returns the files as they have been stored on the Linux server (which is not alpha numerically). I have tried using variations of sort() and natsort() with no success... there is always a parsing error either on the line or after the line where I insert it. Suggestions???? Mod edit: ... add around your code. Also use <?php so code is color coded inside the code tags Quote Link to comment Share on other sites More sharing options...
Kevin Marks Posted December 6, 2007 Author Share Posted December 6, 2007 Thx Mod for the heads up... my first time on this board.... Still looking for help on the sorting suggestions Quote Link to comment Share on other sites More sharing options...
revraz Posted December 6, 2007 Share Posted December 6, 2007 Post the error. I have tried using variations of sort() and natsort() with no success... there is always a parsing error either on the line or after the line where I insert it. Suggestions???? Mod edit: ... add around your code. Also use <?php so code is color coded inside the code tags Quote Link to comment Share on other sites More sharing options...
Kevin Marks Posted December 6, 2007 Author Share Posted December 6, 2007 <?php // create an array to hold directory list $results = array(); // create a handler for the directory $handler = opendir($directory); // keep going until all files in directory have been read while ($file = readdir($handler)) { // if $file isn't this directory or its parent, // add it to the results array if ($file != '.' && $file != '..') { $results[] = $file; } } //to fix sorting issue due to readdir() function natsort($results) // tidy up: close the handler closedir($handler); ?> and the error is is producing. Parse error: syntax error, unexpected T_STRING on line 61 Line 61 is the closedir($handler) line Quote Link to comment Share on other sites More sharing options...
revraz Posted December 6, 2007 Share Posted December 6, 2007 Missing semi colon right above it? natsort($results) Quote Link to comment Share on other sites More sharing options...
Kevin Marks Posted December 6, 2007 Author Share Posted December 6, 2007 Revraz.... I am retarded.... and you sir are a lifesaver.... You kick butt in about a million different ways for me right now. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 6, 2007 Share Posted December 6, 2007 Glad to have helped Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.