I've set up my foundation 5 orbit to work with MODx and all is good except... let's say the user doesn't want the slider on a particular page, but rather wants to use a single static image. At this point, with no images inserted into the MIGx form, the orbit previous and next arrows are still displaying in my page layout.
Is there are way to toggle the slider off, or give the option to the user to select either the slider, or a TV for a single image instead?
Any feedback greatly appreciated.
Maybe my question should be: How do I make TVs optional?
Typically if a TV is empty, then nothing is generated on the page. However, my TV and chunks for my Orbit Slider/MIGx combination at a minimum is generated an empty ul with a class that's inserting the previous and next buttons..
you can put the code for your slider into a chunk, also the code for the single image.
Than setup a checkbox - TV named for example 'slider_selector' with input-options like:
show slider==[[$sliderChunk]]||show image==[[$imageChunk]]
in your template you would just put the TV-tag of this checkbox-TV:
I'm looking at my current set up and trying to figure out how to implement your advice. Maybe my setup for the Orbit Slider and MIGx is not correct or the best way? I have a TV dh.imageslider that has the form for the Orbit Slider, and I have 2 chunks for the orbit slider: dh.slider which contains the ul code and dh.images.gallery.tpl which contains the li code.
So now I'm stumped. Should I put the TV, dh.imageslider, into one chunk (i.e. sliderChunk), and the put a TV that I have for a static image (mainImage) into another chunk (i.e. imageChunk)
Really though, what's putting content on the page is the dh.slider because the ul contains the class that's bringing in the controls for the slider. So perhaps I only put the dh.slider
Well, probably just need to start trying some things out and see what works. Since this is my first time, it's a bit overwhelming trying to understand what's putting what where.
Thanks for your input.
I think I'm getting it to work.
So far so good. Just need to do some tweaking. Somehow I have the contents of my caption field appearing in both the actual orbit caption, and as the alt tag.
I tried putting in a URL on the image, but it's not showing up. Perhaps in the field for link I or the user will need to input the link in MODx style using brackets and the tilde symbol.
Thank you again for your response. Super helpful.
[ed. note: mmcgee last edited this post 12 years, 7 months ago.]
If you would show some of your code, it would be easier to help.
-
☆ A M B ☆
- 1,780 Posts
An output filter would work best for this. Rather than trying to force orbit display a static image, just don't use orbit if you don't need it.
Make a radio TV, title it "slider" or whatever. Describe: "Do you want to use a slider on this page?". Then enter the input options Yes==1||No==0
Assign it to your template(s)
Make a chunk with all your orbit code including MIGX call.
Make an image TV so your users can select a single image, assign to template(s).
Make another chunk with your image code, call the static image TV within.
Using the If snippet:
[[!If? &subject=`[[*slider]]` &operator=`EQ` &operand=`1` &then=`[[$orbitChunk]] &else=`[[$imageChunk]]`]]
Output filter:
[[*slider:is=`1`:then=`[[$orbitChunk]]`:else=`[[$imageChunk]]`]]
Alternately, you don't actually need chunks, you could just place the two different bits of code where the chunks are shown.
Thanks for all of the feedback. It does seem that perhaps there are multiple ways of accomplishing this task. I'm not trying to get orbit to display one static image though. I have a TV for Orbit and a TV for a single static image, with the goal of allowing the user to determine which they want to use. Bruno's checkbox method is working thus far, however, I need to change from my inadvertently chosen "List Item", to "Check Box".
So far what Bruno put forth is working, it's just a matter of refining the content of the slider (caption or no caption) etc. If there's no caption on the photo, then I need to comment out the caption div because it has built in padding that forces the div open about 1em even though there's no text within.
I need to spend some time re reading about the MICx form and how that all works. I see "set" as one of my columns and I can't remember what that is for. Also need to figure out how to get a link applied to the photo.
Thanks for all of your feedback. I have been procrastinating this portion of my site, and you rapid feedback and tips are well received and extremely helpful.
-
☆ A M B ☆
- 24,524 Posts
Put the block for the slider in a chunk. Put the block for the image in another chunk. Then where the slider or the image goes, put this:
[[[[*id:is=`[[++site_start]]`:then=`$slider-chunk`:else=`$image-chunk`]]]]
No need for TVs snippets or anything.
You'll notice that the inner references to the chunks don't have tags, while the whole thing is in doubled tags. This is so that instead of processing all inner tags, then deciding which one to output, it simply outputs the appropriate chunk tags for MODX to process on the next pass through the parser.