<ul class="top_ads">
<?php
$totalImages = 5;
$all = range(1,$totalImages);
shuffle($all);
foreach ($all as $single) {
echo "<li><a href='' /><img src='"; echo bloginfo('template_url') . "/images/ads/ad_0$single.png' alt='ad' /></li>";
}
?>
</ul>
can anyone please explain bloginfo('template_url') within this php code? sorry, if it seems trivial to you. also the path "/images/ads/ad_0$single.png". I am learning php. Thank you.
Which function I need to use in place of bloginfo('template_url') if I do not use wordpress but php as a template engine? anyone helps me?
the function is randomizing 5 ads.
each ad has the name in: /images/ads/ad_01.png .. /images/ads/ad_05.png.
first the range (1, 5) makes an array {1,2,3,4,5} shuffle mixes it up so it looks more like {4,3,5,1,2} foreach ($all as $single) will call the echo statement for each of those numbers in the new order
bloginfo('template_url') is a function somewhere else in your code. it is outputting a template url path partial. most likely its something like /templates.
using chrome: you can figure that out by right clicking on one of these ads and choosing inspect element and find the exact url that is being built out.