We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35516
    • 9 Posts
    As I don’t see something like this covered, here goes:


    Firstly you’ll need the world’s most awesome slider, of course smiley

    http://nivo.dev7studios.com/


    Copy jquery.nivo.slider.pack.js & jquery-1.4.3.min.js to your template’s js folder,
    and also modified nivo-slider.css to the css folder.


    Modified nivo-slider.css :

    /*
     * jQuery Nivo Slider v2.5.1
     * http://nivo.dev7studios.com
     *
     * Copyright 2011, Gilbert Pellegrom
     * Free to use and abuse under the MIT license.
     * http://www.opensource.org/licenses/mit-license.php
     * 
     * March 2010
     */
     
     
    /* The Nivo Slider styles */
    .nivoSlider {
    	position:relative;
    }
    .nivoSlider img {
    	position:absolute;
    	top:0px;
    	left:0px;
    }
    /* If an image is wrapped in a link */
    .nivoSlider a.nivo-imageLink {
    	position:absolute;
    	top:0px;
    	left:0px;
    	width:100%;
    	height:100%;
    	border:0;
    	padding:0;
    	margin:0;
    	z-index:6;
    	display:none;
    }
    /* The slices and boxes in the Slider */
    .nivo-slice {
    	display:block;
    	position:absolute;
    	z-index:5;
    	height:100%;
    }
    .nivo-box {
    	display:block;
    	position:absolute;
    	z-index:5;
    }
    /* Caption styles */
    .nivo-caption {
    	position:absolute;
    	left:0px;
    	bottom:0px;
    	background:#000;
    	color:#fff;
    	opacity:0.8; /* Overridden by captionOpacity setting */
    	width:100%;
    	z-index:8;
    }
    .nivo-caption p {
    	padding:5px;
    	margin:0;
    }
    .nivo-caption a {
    	display:inline !important;
    }
    .nivo-html-caption {
        display:none;
    }
    /* Direction nav styles (e.g. Next & Prev) */
    .nivo-directionNav a {
    	position:absolute;
    	top:45%;
    	z-index:9;
    	cursor:pointer;
    }
    .nivo-prevNav {
    	left:0px;
    }
    .nivo-nextNav {
    	right:0px;
    }
    /* Control nav styles (e.g. 1,2,3...) */
    .nivo-controlNav a {
    	position:relative;
    	z-index:9;
    	cursor:pointer;
    }
    .nivo-controlNav a.active {
    	font-weight:bold;
    }
    
    /*============================*/
    /*=== Custom Slider Styles ===*/
    /*============================*/
    #nivo-slider-wrapper {
        margin:0 auto;
        width:618px;
    }
    
    #slider {
    	position:relative;
    	background:url(images/loading.gif) no-repeat 50% 50%;
    }
    #slider img {
    	position:absolute;
    	top:0px;
    	left:0px;
    	display:none;
    }
    #slider a {
    	border:0;
    	display:block;
    }
    
    .nivo-controlNav {
    	position:absolute;
    	left:260px;
    	bottom:-42px;
    }
    .nivo-controlNav a {
    	display:block;
    	width:22px;
    	height:22px;
    	background:url(images/bullets.png) no-repeat;
    	text-indent:-9999px;
    	border:0;
    	margin-right:3px;
    	float:left;
    }
    .nivo-controlNav a.active {
    	background-position:0 -22px;
    }
    
    .nivo-directionNav a {
    	display:block;
    	width:30px;
    	height:30px;
    	background:url(images/arrows.png) no-repeat;
    	text-indent:-9999px;
    	border:0;
    }
    a.nivo-nextNav {
    	background-position:-30px 0;
    	right:15px;
    }
    a.nivo-prevNav {
    	left:15px;
    }
    
    .nivo-caption {
        text-shadow:none;
        font-family: Helvetica, Arial, sans-serif;
    }
    .nivo-caption a { 
        color:#efe9d1;
        text-decoration:underline;
    }
    
    /*====================*/
    /*=== Other Styles ===*/
    /*====================*/
    .clear {
    	clear:both;
    }
    



    Also copy the following images to "images" folder that is inside your template’s css folder:

    arrows.png
    bullets.png
    loading.gif


    Link the js and css files in your template head (you can create special template for nivo if you want):

    <link rel="stylesheet" media="all" type="text/css" href="path_to_your_template/css/nivo-slider.css" />
    <script type="text/javascript src="path_to_your_template/js/jquery-1.4.3.min.js""></script>
    <script type="text/javascript" src="path_to_your_template/js/jquery.nivo.slider.pack.js"></script>
    



    Insert this also (for additional parameters check nivo’s documentation):

    <script type="text/javascript">
        $(window).load(function() {
            $('#nivoslider').nivoSlider();
        });
        </script>
    




    Now you’re ready to create some TVs & a chunk that will be used to "automate" slides creation:

    For each slide you’ll need three TVs, one for image, one for image caption and one for the url actual slide will be linking to:

    1. nivo_01_caption - Input Type: ReachText,
    2. nivo_01_img - Input Type: Image, Output can be Text,
    3. nivo_01_url - Input Type: Text.

    Repeat the process for additional (02,03,04,...) slides.
    (Do not forget to give access for all TVs to the template that holds the slider code..)


    Then create chunk named "nivoslider" with the following code (as you can see, the example holds four slides) :

    <div id="nivo-slider-wrapper">
    <div id="nivoslider" class="nivoSlider">
                    <a href="[[*nivo_01_url]]"><img title="#nivo_01_caption" src="[[*nivo_01_img]]" /></a>
                    <a href="[[*nivo_02_url]]"><img title="#nivo_02_caption" src="[[*nivo_02_img]]" /></a>
                    <a href="[[*nivo_03_url]]"><img title="#nivo_03_caption" src="[[*nivo_03_img]]" /></a>
                    <a href="[[*nivo_04_url]]"><img title="#nivo_04_caption" src="[[*nivo_04_img]]" /></a>
                    </div>
    </div>
                
                
    <div id="nivo_01_caption" class="nivo-html-caption">
                    [[*nivo_01_caption]]
                </div>
    
    <div id="nivo_02_caption" class="nivo-html-caption">
                    [[*nivo_02_caption]]
                </div>
                
    <div id="nivo_03_caption" class="nivo-html-caption">
                    [[*nivo_03_caption]]
                </div>
                
    <div id="nivo_04_caption" class="nivo-html-caption">
                    [[*nivo_04_caption]]
                </div>
    


    (You can group all of the above in e.g. "Nivo Slides" Category for better organization if you like)



    Finally call the chunk somewhere in your template with:

    [[$nivoslider]]



    Now it’s time to create the resource that will show the Nivo Slider:


    Select the template you created for the slider, fill the TVs - add images (best to try it out with original nemo.jpg, toystory.jpg, up.jpg, walle.jpg, otherwise tweaks to included css are needed), captions (can hold additional links, etc), and urls to the resources (e.g. in [[~id]] format)...



    If both you and me are not forgetting something (I maybe am, since I’m reverse-engineering already done process..), Preview should show not only the most awesome but also easily configurable slider modx community ever witnessed smiley



    Hope this will be helpful for some, so try it and of course let us all know if you have some ideas on improving it further.
      • 28121
      • 107 Posts
      Hey. Thanks for taking time to do this.
      Looking forward to trying it out.
      Peter
        • 4172
        • 5,888 Posts
        Thanks for this little Tut.

        If you don’t want to create TVs for each image you can do the same with one TV and MIGX.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 35516
          • 9 Posts
          Yes, that would be even better, especially with more images - MIGX is really essential extra!

          BTW, noticed that you added it to rtfm, now with a good manual I’m sure it’ll get the exposure it deserves.
            • 3749
            • 24,544 Posts
            Very nice. cool

            Thanks for contributing!
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 25803 ☆ A M B ☆
              • 721 Posts
              Will have to try this out. We’ve been just doing it manually but that is not good for clients. Someone mentioned they got it working with Gallery but I gave up as I couldn’t figure out how to do it. We did do it with EvoGallery though for Evolution but had to add the ability to add a link to each image in EvoGallery.

              This sort of thing is so common in web sites now.
                • 4172
                • 5,888 Posts
                Quote from: TomMLS at May 19, 2011, 10:44 AM

                Would someone please add SPECIFIC information about how to "If you don’t want to create TVs for each image you can do the same with one TV and MIGX"??

                Specific meaning instructions specific to this tutorial etc. smiley

                Thank you, Tom

                Here you go. Not Tested yet, but something like that should work.

                Let’s start at this point of the above Tutorial:

                Now you’re ready to create some TVs & a chunk that will be used to "automate" slides creation:

                Create two TVs, for your form, don’t assign them to any template

                1. caption - Input Type: richtext,
                2. image - Input Type: Image, Output can be Text

                Create the MIGX - TV

                name: nivoslides Input Type: migx

                add this input-properties (revo 2.1)

                Tabs:

                [
                {"caption":"Image", "fields": [
                    {"field":"name","caption":"Name","description":"Name for the image"},
                    {"field":"url","caption":"Url"}, 
                    {"field":"image","caption":"Image","inputTV":"image"}
                ]}, 
                {"caption":"Caption", "fields":[
                    {"field":"caption","caption":"Caption","inputTV":"caption"}
                ]}
                ] 
                


                Columns:

                [
                {"header": "Name", "width": "160", "sortable": "true", "dataIndex": "name"}, 
                {"header": "Image", "width": "50", "sortable": "false", "dataIndex": "image","renderer": "this.renderImage"}
                ]
                



                Then create chunk named "nivoslider" with the following code :

                <div id="nivo-slider-wrapper">
                <div id="nivoslider" class="nivoSlider">
                [[getImageList? &tvname=`nivoslides` &tpl=`@CODE:<a href="[[+url]]"><img title="#nivo_[[+idx]]_caption" src="[[+image]]" /></a>`]]
                </div>
                </div>
                            
                
                [[getImageList? &tvname=`nivoslides` &tpl=`@CODE:
                <div id="nivo_[[+idx]]_caption" class="nivo-html-caption">
                                [[+caption]]
                            </div>
                `]]
                
                



                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 35516
                  • 9 Posts
                  Thanks Bruno, this appears to be easy enough to implement..

                  For versions 2.0.x I guess this is the (untested:) js code that should be imported, please rectify if it’s wrong:

                  [
                  {"name":"formtabs","desc":"","xtype":"textarea","options":[],"value":"
                  [
                  {"caption":"Caption", "fields": [
                  {"field":"caption","caption":"Caption","inputTV":"caption"}
                  ]  }, 
                  {"caption":"Image", "fields": [
                  {"field":"image","caption":"Image","inputTV":"image"}, 
                  {"field":"url","caption":"Url"}, 
                  {"field":"name","caption":"Name","description":"Name for the image"}
                  ] }
                  ]
                  ","lexicon":null,"overridden":false,"desc_trans":"","menu":null},
                  {"name":"columns","desc":"","xtype":"textarea","options":[],"value":"
                  [
                  {"header": "Name", "width": "160", "sortable": "true", "dataIndex": "name"}, 
                  {"header": "Image", "width": "50", "sortable": "false", "dataIndex": "image","renderer": "this.renderImage"}
                  ]
                  ","lexicon":null,"overridden":false,"desc_trans":"","menu":null}
                  ]
                  


                  Tom, do let us know if all of this is working smiley
                    • 34000
                    • 77 Posts
                    Awesome thanks for this tutorial, building a feature slider has been somewhat of a mystery for me, but it’s also the holy grail of a news magazine type website.
                    Haven’t had a chance to work through this one yet, but I know Nivo Slider is one slick slider, the animations are slick!
                      MODx Revo 2.1 and done!
                      • 16702 ☆ A M B ☆
                      • 536 Posts
                      Hello Bruno,
                      first great tutorial! Work PERFECT!

                      how can i put default value to MIGX - TV?
                      Thanks,
                      Kr.
                        palma non sine pulvere