I need to show arrayList in a html < li > How I send this variable with all the files from php to my html list.
I tryed like this but I don't know whats wrong.. :'(
This is my php code:
$directorioInicial = "./"; //Especifica el directorio a leer
$rep = opendir($directorioInicial); //Abrimos el directorio
$listaHtml = array();
while ($todosArchivos = readdir($rep)) { //Leemos el arreglo de archivos contenidos en el directorio: readdir recibe como parametro el directorio abierto
if ($todosArchivos != '..' && $todosArchivos != '.' && $todosArchivos != '' && strpos($todosArchivos, '.html') && !is_dir($todosArchivos)) {
$listaHtml[] = $todosArchivos;
}
}
foreach ($listaHtml as $i) {
// echo $i . "<br>";
}
And this is my html list:
<div class="propiedadesCaja" id="acordeon">
<ul>
<li class="listaPaginas">
<a class="listado" href="<?php echo $i; ?>" target="probando" ></a>
</li>
</ul>
</div>
Really Thank you.
Your HTML can look like this:
<div class="propiedadesCaja" id="acordeon">
<ul>
<?php foreach($listaHtml as $i){ ?>
<li class="listaPaginas">
<a class="listado" href="<?php echo $i; ?>" target="probando">Text here</a>
</li>
<?php } ?>
</ul>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With