Hisashi Posted September 3, 2022 Posted September 3, 2022 (edited) Hello, I have a comic book reader, I want to make every 'x' amount of images display an ad. These are the field settings: Quote Code: {{if $formValue}} <div class="ipsGrid ipsGrid_collapsePhone ipsType_center"> {{foreach $value as $file}} <img data-src="{file='$file' extension='cms_Records'}" loading="lazy" class="ipsImage ImgMargem" alt="{$record->_title} by {$record->customFieldDisplayByKey('artista_manga', 'raw')}"><br> {{endforeach}} </div> {{endif}} Result: Quote Let's say I uploaded 30 images. I want to make the ad appear every '5' images. ------ I could do something like this, but this is not the correct way, as the ad is repeated for each image. Quote What needs to be done? As I showed in the last image, may not even need a plugin, just a code that prevents repeated and set a value. (I can pay for that information too). If a plugin is really needed, it just needs to have the following functions. Send me a private message if interested. Edited September 3, 2022 by Hisashi
Nathan Explosion Posted September 3, 2022 Posted September 3, 2022 Untested in Pages... {{if $formValue}} <div class="ipsGrid ipsGrid_collapsePhone ipsType_center"> {{$test = 0;}} {{foreach $value as $file}} <img data-src="{file='$file' extension='cms_Records'}" loading="lazy" class="ipsImage ImgMargem" alt="{$record->_title} by {$record->customFieldDisplayByKey('artista_manga', 'raw')}"><br> {{$test++;}} {{if $test % 5 == 0}} <YOUR AD STUFF> {{endif}} {{endforeach}} </div> {{endif}} SeNioR-, Afrodude and Hisashi 2 1
Hisashi Posted September 3, 2022 Author Posted September 3, 2022 6 minutes ago, Nathan Explosion said: Untested in Pages... {{if $formValue}} <div class="ipsGrid ipsGrid_collapsePhone ipsType_center"> {{$test = 0;}} {{foreach $value as $file}} <img data-src="{file='$file' extension='cms_Records'}" loading="lazy" class="ipsImage ImgMargem" alt="{$record->_title} by {$record->customFieldDisplayByKey('artista_manga', 'raw')}"><br> {{$test++;}} {{if $test % 5 == 0}} <YOUR AD STUFF> {{endif}} {{endforeach}} </div> {{endif}} INCREDIBLE!! Worked perfectly. SeNioR- and Nathan Explosion 2
Recommended Posts