We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5008
    • 21 Posts
    Hi I have created a site with a custom template and I would like to learn how to add a custom image slider with images relevant to each page.
    the website url mtcbuilders.com

    Please let me know of any other relevant information I need to provide.
    • I would presume that each page has a TV or something to provide the image for the page.

      If that is the case, you can use a listing snippet like Ditto to generate a list of the images, with its output display chunk tpl set up to generate the code for each item that your Javascript slider expects.

      What I always do is to put a single item's HTML, taken from my chosen Javascript app's demo code, into the tpl chunk, then replace the relevant dynamic bits with the appropriate placeholders from the Ditto snippet.

      MODX doesn't care what Javascript or CSS you use. All you need to do is get the HTML code the slider app you choose expects.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 2762
        • 1,198 Posts
        I use two methods to manage Sliders:

        1) Method 1: Slider with ditto items: the same method of Susan smiley

        Basic Example with Nivo Slider

        Create a Template Variable:
        * name: gotoSlider
        * type: Dropdown
        * input value: no||yes
        * default value: no


        Call for Slider inside template:
        <div id="slider" class="nivoSlider">
        [!Ditto?  &parents=`0` &filter=`gotoSlider,yes` &hideFolders=`1` &extenders=`summary,dateFilter` &tpl=`SliderTpl` &display=`10`!]
        </div>


        Basic Ditto SliderTpl
         <a href="[~[+id+]~]" title="[+title+]"><img src="[+SliderImage+]" alt="[+title+]" title="[+description+] "/></a>


        Pros:
        * comfortable to add/remove your ditto documents in the slider

        Cons:
        * You need to open each documents to add/remove
        * Pictures of the items must have the right size for the slider
        * You can not sort Slides order



        2) Method 2: Use a MultiTv to manage Slider images and contents
        example:
        http://www.tattoocms.it/extras/multitvs/nivoslider-multitv-for-modx-evolution.html

        Pros:
        * You can quickly add remove Slides
        * You can quickly sort Slides order
        * You can quickly change images and text in Slides
        * You dont need to open each documents
        * You can use a separate/custom image for the slider

        Cons:
        * You need to enter each slide, images and text
        * You need to need to find the document url to add in your slide [ed. note: banzai last edited this post 9 years, 8 months ago.]
          Free MODx Graphic resources and Templates www.tattoocms.it
          -----------------------------------------------------

          MODx IT  www.modx.it
          -----------------------------------------------------

          bubuna.com - Web & Multimedia Design
          • 5008
          • 21 Posts
          Thank you both for your prompt reply I will have a go and let you know what works.

          Thanks again.