Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
rah_repeat // Split and repeat.
It’s all about splitting and repeating stuff. Turning comma delimiter separated lists into something else, like for example rich HTML lists. Has the ability to filter, remove duplicates and sort values.
Examples equal 1,000 words — and are lovely confusing. Enjoy pancakes:
<txp:rah_repeat value="mayonnaise, syrup, blueberry, breakfast" exclude="mayonnaise" trim="1" break="li" wraptag="ul">
<txp:rah_repeat_value />
</txp:rah_repeat>
Gives following pancake fitting dressings, no mayonnaise:
<ul>
<li>syrup</li>
<li>blueberry</li>
<li>breakfast</li>
</ul>
More info, examples and download
Last edited by Gocom (2011-12-02 11:37:19)
Offline
Re: rah_repeat // Split and repeat.
This is a great plugin. Clever!
…Prrrrrrrr…
Offline
#3 2009-11-20 19:14:01
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Offline
Re: rah_repeat // Split and repeat.
oh! just wanted to use php’s explode
for cf fields… Now will look into your plugin :)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: rah_repeat // Split and repeat.
Genius!
Offline
#6 2009-11-23 01:07:25
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: rah_repeat // Split and repeat.
A mass-wrapping tool well-timed for christ-mass: Wrap the masses ;)
Cool gadget! Thank you, Jukka :)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: rah_repeat // Split and repeat.
Thank you all :)
Version 0.2 released. Changelog:
- Added
limit
andoffset
. - Well made use of list when the list is a one item.
Rah_repeat for savior:
<txp:rah_repeat value="1|limit,2|offset">
<txp:rah_repeat value='<txp:rah_repeat_value />' limit="1" delimiter="|">
<h3>Change #<txp:rah_repeat_value /></h3>
</txp:rah_repeat>
<txp:rah_repeat value='<txp:rah_repeat_value />' offset="1" delimiter="|">
<p>Added attribute <code><txp:rah_repeat_value /></code>.</p>
</txp:rah_repeat>
</txp:rah_repeat>
See the changelog no-list again, more cool examples, updated attribute quides and have loads of *downloads*. Longest link ever.
Offline
Re: rah_repeat // Split and repeat.
Nice: simple and elegant, and obviates my need for the old sed_packed_custom_fields (which I was only using in “foreach” mode).
Given that this deals with lists, wraptag
and break
would be nice additions.
Code is topiary
Offline
Re: rah_repeat // Split and repeat.
jsoo wrote:
Given that this deals with lists,
wraptag
andbreak
would be nice additions.
Version 0.3 released ;) Adds:
- Added attribute:
wraptag
. - Added attribute:
break
. - Added attribute:
class
.
Offline
Re: rah_repeat // Split and repeat.
I edited first version to add trim for exploded values. And my “hack” cleaned delimiter, if it was lonely left in the end of string. Here is the link for you, Jukka. May be this function will be useful for ver. 0.4 )
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: rah_repeat // Split and repeat.
the_ghost wrote:
I edited first version to add trim for exploded values.
Thank you for efforts. If someone wants to trim the string, the user can use a plugin that allows one to use trim (rah_function for example). I won’t be adding anykind of output formating in the plugin.
As we speak, it seems that 0.3 is now stable and will be feature locked, meaning that it is the final version and no new features are planned.
Offline
Re: rah_repeat // Split and repeat.
I think trimming and deleting lonely delimiters is rather useful. Imaging we create list of values and get such string: Minsk, Tokio, New-Yourk, Oslo, Helsinki,
– in such way we will get 6 repeatings, instead of 5. To eliminate this we have to use if_last
logic while geenrating string.
And another usful tag, just thought about it – rah_if_last/first – will be very good :)
Last edited by the_ghost (2009-11-30 07:09:26)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline