Ok so have created two javascipt functions and i want to call them inside a php loop while passing php variable as parameter to the second function
addElements($filePath)
this filePath variable has to be the last one from the inner loop i guess written like this will not get the first variable from the first loop
Here is what I want and what have written so far:
<script>
<?php foreach( glob( 'posts/*' ) as $filePath ){
//createPost(); call js function declared in header
foreach( glob( $filePath.'/*' ) as $filePath ){
//addElements($filePath) call second hs function declared in header here i pass the last $filePath from the second loop as parameter
}
}?>
</script>
Another try but still doesn't work
<script>
<?php foreach( glob( 'posts/*' ) as $filePath ){
//createPost(); call js function declared in header
echo 'createPost()';
foreach( glob( $filePath.'/*' ) as $filePath ){
//addElements($filePath) call second hs function declared in header here i pass the last $filePath from the second loop as parameter
echo 'addElements('.$filePath.')';
}
}?>