If you’re a Stack developer/designer and you’ve been following the new API details, then there’s been plenty to play with:
- New asset tags
- New edit mode conditional tags
- Built in jQuery and MooTools support.
Zowie! It’s a lot to take in.One More Thing
But… I have a confession. I’ve been holding out on you. I’ve been saving one more feature for last. Mostly, it wasn’t because I enjoy teasing you, though. I wasn’t absolutely certain it was possible and stable. But after some thourough testing and development I’m ready to show it off. Ready?Repeating Elements
Repeating elements allow you to build subgroups, then let the user choose how many they would like using a slider. The subgroups can include editable areas like Text, HTML, Images, and Slices or anything else you like. Plus they don’t come with the usual Stacks bagage: no stacks_in or stacks_out divs.An Example
I’ve put together a simple example showing how it might work.
The function of the stack is pretty simple, though. It allows the user to drag in a number images and creates a fade between them. Yawn. Ho hum.
But it utilizes some of the new API features like conditionals, to make the UI super clean and nice. It gives the user nice “drop zones” for images. If every other stacks developer used this system or improved upon it, I’d be a happy camper!
Please feel free to use any code you find in this stack to build your own.
If you’re not using the beta version of Stacks, don’t download this. It won’t work in Stacks 1.2.The Template Code
But really, the magic of the repeat is in the template code. And the good part is right in the middle. Let’s skip to it:
%[if edit]%<div class='faydr_image_out'>%[endif]%
You can see that I’ve included the %[repeat count]% template variable. repeat is a reserved work and count in this example is the ID of a custom slider control. The content between the repeat and the endrepeat will be copied count times. The content inside the div will be repeated verbatim without an enclosing stacks_in or stacks_out div. This gives you much more direct contact with groups of images or groups of, well… groups of anything.It’s in There
The best news about this is if you’re using the Stacks beta, then you already have a copy of this in your hand. This feature has been part of Stacks for several weeks. So you can start playing with it today.Stacks by YourHead
We’ll also be selling a small upgrade to Stacks users in the way of an add-on pack. The pack will include an unordered list, an ordered list, a definition list, and a repeating floating column.
For users we think these will be really useful additions that will simplify some of the complex structures we see advanced users building all the time.
For developers, this is fair warning — you might not want to work on something else — basic lists and floats will be taken care of. ;-)