This php file finds every ".html" file and ".txt" file and creates a dynamically table with a link to another page. In that page i want to show in a frame the html file clicked on.
<html>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<body>
<?php
echo '<h2>Escolha o Esquema de MetaDados a utilizar</h2>';
echo '<table cellspacing="0" cellpadding="0" border="0" class="table">';
echo '<tr>';
echo '<th>Esquema de MetaDados</th>';
echo '<th>Descrição</th>';
echo '</tr>';
foreach (glob("Templates/Dinamico/*.html") as $filename) {
foreach(glob("Templates/Dinamico/*.txt") as $txtname){
$fileH= basename($filename,".html");
$fileT= basename($txtname,".txt");
if($fileH==$fileT){
$txt= file_get_contents ( $txtname);
if($filename != "Templates/Dinamico/formD1.html"){
echo'<tr>';
echo'<td>';
echo "<a name='".$fileH."'strong href='Templates/Dinamico/formD1.php'>".$fileH."</a>";
echo'</td>';
echo'<td>';
echo $txt;
echo'</td>';
echo'</tr>';
}
}
}
}
?>
</body>
</html>
This file is where the link page set above and it the a element clicked on populate the iframe with the name assign to the "a" element.
<html>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<body>
<div>
<?php
This $a var i want to be the $fileH clicked on
echo '<iframe src="' .$a.'" frameBorder="0" width="70%" height="100%" align="left" scrolling="no" />';
echo '</iframe>'
?>
</div>
</body>
</html>