I am creating one module for joomla (backend) which must scan given folder for images (which is out of admin directory) and display for each of them input fields. $dir
variable gets value of iDirName
field from xml files field of joomla module which user types from module edit page.
This file below works only if directory is images and searches for folder within module directory, not root directory of site. Even if I have added in modules image directory another directory()
, it does not work, so it can scan /administrator/modules/mod_slide_url_add/images/ this directory but not this /administrator/modules/mod_slide_url_add/images/headers.
I need to be able to scan /images/headers directory from joomla root. Before I used one small form with action to this php file and it worked for fine when I was typing directory like this ../../../images/headers but in this case I was redirected from joomla admin page to clear page with that php file and was getting input fields on a clear page, not on a joomla page. Now I am trying to display that fields directly on joomla page without any redirect. Can you help me?
<?PHP
$dir = $params->get('iDirName','1');
echo "Dir=";
echo $dir;
?>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<form action="modules/mod_slide_url_add/ValidateWriteLinks.php" autocomplete="off" method="post">
<?PHP
if(isset($dir) && $dir!='' && !empty($dir))
{
$slcfN=0;
$sclfTargetDirectory = $dir;
foreach(glob($sclfTargetDirectory.'*.{jpg,png,gif}',GLOB_BRACE) as $slcfFileName)
{
$slcfN++;
$info = pathinfo($slcfFileName);
$file_name = basename($slcfFileName,'.'.$info['extension']);
$slcfFileName = $sclfTargetDirectory.$file_name.'.txt';
if(!file_exists($slcfFileName))
{
$FileHandle = fopen($slcfFileName, 'w') or die("can't open file");
fclose($FileHandle);
}
echo "<tr><td>";
echo "File No $slcfN -".basename($slcfFileName);
echo "</td><td>";
echo "<input type='text' name='URLNo$slcfN' maxlength='105' size='35'>";
echo "<input type='checkbox' name='ChkBoxNo$slcfN' value='Yes' /> Del File Contents...";
echo "<input type='hidden' name='FilenameNo$slcfN' value='$slcfFileName'>";
echo "</td></tr>";
}
echo "<tr><td>";
echo "<input type='hidden' name='slcCounterS' value='$slcfN'>";
echo "</td><td>";
echo "<input type='submit' value='E N T E R'>";
echo "</td></tr>";
}else{echo"ERROR LVL1";}
?>
</form>
</table>