Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-20 17:06:48

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

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

#2 2009-11-20 18:17:44

TNT
Member
From: Rotterdam, Netherlands
Registered: 2006-01-06
Posts: 256
Website

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

Re: rah_repeat // Split and repeat.

Looks like it will be very useful. Thanks!

Offline

#4 2009-11-20 20:03:08

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

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

#5 2009-11-22 23:43:44

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

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

#7 2009-11-23 04:35:07

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: rah_repeat // Split and repeat.

Thank you all :)

Version 0.2 released. Changelog:

  • Added limit and offset.
  • 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

#8 2009-11-28 13:12:01

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

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

#9 2009-11-28 15:40:11

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: rah_repeat // Split and repeat.

jsoo wrote:

Given that this deals with lists, wraptag and break would be nice additions.

Version 0.3 released ;) Adds:

  • Added attribute: wraptag.
  • Added attribute: break.
  • Added attribute: class.

More info and downloads

Offline

#10 2009-11-29 07:31:06

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

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

#11 2009-11-29 10:58:22

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

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

#12 2009-11-30 07:08:16

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

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

Board footer

Powered by FluxBB