jquery - Insert specific image every 10 images in a php slideshow -


i made simple php loop loads images directory , puts them in jquery slideshow. here's php code:

 <?php function scd($dir){$files=scandir($dir);sort($files);reset($files);return $files;}  $output='<script>$.backstretch(['; $dir='images'; $files=scd($dir); foreach($files $file){     if($file==='.'||$file==='..'){continue;}         $output.='"'.$dir.'/'.$file.'"     , '; } echo $output.'  ], {duration: 10000, fade: 1000});</script>'; ?> 

i'd insert specific image external directory (i.e. advertisement company) every 10 slides have no clue on how it.

any appreciated !

thanks in advance,

martin

use counter of sort keep track of how many images you've displayed , display advertisement when counter%10 ==0

$counter = 1 foreach($files $file){     if($file==='.'||$file==='..'){continue;}     if($counter%10 == 0)          $output .= //advertisement link     $output.='"'.$dir.'/'.$file.'", ';     $counter++ } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -