Hi,
I have a specific requirement for nevo slider for every page, I have around 20 pages with different image set for each. I have a nevo slider chunk with getResource but it is only for specific parent id. Now I want to make that dynamic so that it shows different image set for every pages.
My code is
Chunk - destination_banners
-----------------------------------
<div id="slider" class="nivoSlider">
[[!getResources? &parents =`7` &includeTVs=`1` &processTVs=`1` &tpl=`tpl_destination_banner_images` &sortDir=`ASC` &limit=`100`]]
</div>
<script type="text/javascript" src="templates/scripts/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider({
directionNav: true,
effect: 'fade'
});
});
</script>
--------------------------------------------------
Chunk - tpl_destination_banner_images
--------------------------------------------------
<img src="[[+tv.banner_image]]" width="870" height="434" />
----------------------------------
And in template I am calling [[$destination_banners]].
Need help so that I can dynamically call each page banner.
Thanks.
-
☆ A M B ☆
- 1,780 Posts
Why not use the id of the page it's being called on and set the images you want on the resources themselves instead of all from resource id 7? How are you determining which images come out of id 7 and what tells all the others which ones to use? If you need different images on each other page, using one resource for all of them won't really work. You could use MIGX to set the images actually, then use getImageList to call them into the slider (that's how I'd suggest doing this).
But, if you want to go with getResources, use &parents=`[[*id]]` to fetch from itself.
With MIGX, just don't set a resource, it assumes to use the id of the resource it's called on.
[[!getImageList? &tvname=`yourMIGXtv` &tpl=`yourNivoTpl`]]