[Templates] Incrementing + outputting a counter value
Jim Spath
jspath at pangeamedia.com
Tue Nov 6 14:06:30 GMT 2007
Andy Wardley wrote:
> Jim Spath wrote:
>> Ideally, I'd like to do something like this:
>>
>> [% tabindex++ %]
>
> Hi Jim,
>
> That will be supported in TT3. As well as all the other usual variants,
> e.g.
>
> tabindex--
> tabindex += 5
> tabindex *= 20
>
> Until then, I'm afraid you're stick with this:
>
>> [% tabindex = tabindex + 1; tabindex %]
>
> Or for this particular application, you might like to do something like
> this
> at the start of the form/page:
>
> [% global.tabcount = 1;
>
> MACRO tabindex BLOCK;
> n = global.tabcount;
> global.tabcount = global.tabcount + 1;
> "tabindex=\"$n\"";
> END
> -%]
>
> Then in your fields you just need to do this:
>
> <input type="text" name="[% name %]" value="[% value %]" [% tabindex %]>
Hi Andy,
I ended up applying the tabindex's I needed using JavaScript... but this
information is good to know... thanks!
How far down the road is a release of TT3?
- Jim
More information about the templates
mailing list