<div class="col-md-4 text-center">
<?php
$filecount = 0;
$dir = 'images/';
$path = realpath($dir);
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
{
$filecount++;
}
$pixels = $filecount*15000;
echo '<span class="fh5co-counter js-counter" data-from="0" data-to=' ."$filecount".' data-speed="5000" data-refresh-interval="50"></span>' . "\n";
?>
<span class="fh5co-counter-label">Photos</span>
</div>
<div class="col-md-4 text-center">
<?php echo '<span class="fh5co-counter js-counter" data-from="0" data-to=' . "$pixels" . ' data-speed="5000" data-refresh-interval="50"></span>' . "\n"; ?>
<span class="fh5co-counter-label">Pixels</span>
</div>
I am new to Node.JS and the above is an example I have in my website of generating HTML dynamically, in this case counting the amount of files in a folder and generating the counter variables dynamically in HTML. From the transition of Node.JS from PHP, I'm wondering what's the easiest way to do something like this using Node.JS (Express.JS)? It's very easy to add quick PHP snippets into HTML code when using PHP to generate dynamic content.
via Carlos Cueto
No comments:
Post a Comment