•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,509 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,661 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 570 | Replies: 1
![]() |
•
•
Join Date: Dec 2005
Posts: 22
Reputation:
Rep Power: 3
Solved Threads: 0
Hello,
I am trying to create a small php script that will display all but a few directories on my server as links. I have created the following code. I had it working when trying to ignore one directory, but now i would like to place the ignored directories within an array and ignore them that way. I am receiving the following error:
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /WWW/it461.dvterry.com/index.php on line 31
Code:
Thanks!!
I am trying to create a small php script that will display all but a few directories on my server as links. I have created the following code. I had it working when trying to ignore one directory, but now i would like to place the ignored directories within an array and ignore them that way. I am receiving the following error:
Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /WWW/it461.dvterry.com/index.php on line 31
Code:
<?php
function listdirs($dir)
{
static $alldirs = array();
$dirs = glob($dir . '/*', GLOB_ONLYDIR);
if (count($dirs) > 0)
{
foreach ($dirs as $d) $alldirs[] = $d;
}
foreach ($dirs as $dir) listdirs($dir);
return $alldirs;
}
$ignoreArray = array("./test","./Homework_2");
?>
<html>
<head>
<title>
Main
</title>
</head>
<body>
<?php
foreach(listdirs('.') as $dir)
{
if (!in_array($dir, $ignoreArray))
// if ( $dir != "./Homework_2");
{
echo "<a href="$dir">"$dir"</a><br />";
}
}
?>
</body>
</html>Thanks!!
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Links list (JavaScript / DHTML / AJAX)
- dont display clicked links ? (PHP)
- Quality directories for add webs (Search Engine Optimization)
- Web site submission (Search Engine Optimization)
- Does Google Penalize for too many inbound links (Search Engine Optimization)
- Horizontal display of data on Repeater control in asp.net (ASP.NET)
- Apache mod_rewrite with Google Ads (Linux Servers and Apache)
Other Threads in the PHP Forum
- Previous Thread: How to modify the New post options in vBulletin?
- Next Thread: PHP vs Cold Fusion


Linear Mode