6 of 6
6
Plugin: Reeposition [Was MoveIt]
Posted: 13 June 2008 06:48 AM   [ Ignore ]   [ # 91 ]  
Grad Student
Rank
Total Posts:  31
Joined  05-12-2008

Aha! why didn’t I think of that.
That works perfectly, thanks Cocoaholic. smile

Profile
 
 
Posted: 28 August 2008 02:47 AM   [ Ignore ]   [ # 92 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi all,

It might be of interest to some users of Reeposition plugin my experience in using this plugin together with Find and Replace plugin and solving parsing order problem.

My initial code was as follows:

{exp:reeposition}

{reeposition
:put_item id="first_item"}

{reeposition
:put_item id="second_item"}

{reeposition
:item id="first_item"}
<ul> First list:
{exp:weblog:entries weblog="commentary" limit="5" sort="asc" sort_by="title"}
<li>{title}</li>
{/exp:weblog:entries}
</ul>
{/reeposition:item}

{reeposition
:item id="second_item"}
<ul> Second List:
{exp:weblog:entries weblog="dictionary" limit="5" sort="asc" sort_by="title"}
<li>{title}</li>
{/exp:weblog:entries}
</ul>
{/reeposition:item}

<textarea cols="60" rows="10">
{exp:replace find="<|>" replace="<|>" multiple="yes"}
{reeposition
:put_item id="first_item"}
{reeposition
:put_item id="second_item"}
{
/exp:replace}
</textarea>

{/exp:reeposition}

This code did not work: Reeposition plugin moved items, but Find and Replace plugin replaced nothing since {exp:replace} tag was parsed before {exp:reeposition} tag.

Trying to add parse=“inward” parameter to {exp:reeposition} tag did not help: {exp:weblog:entries} remained unparsed.

In this situation needed parsing order is this:
1) {exp:weblog:entries} tag
2) {exp:reeposition} tag
3) {exp:replace_plus} tag

But to achieve such parsing order was not possible because we cannot wrap {exp:reeposition} tag with {exp:replace_plus} tag - if we did the Find and Replace plugin replaced characters inside and outside of <textarea> element.

Solution I adopted is this: I tweaked Find and Replace plugin by introducing {replace_area_start}{replace_area_end} variable pair. This variable pair allows us to delimit area in which we want replace operation to be done and by delimiting such area it allows us to wrap with Find and Replace plugin tag some other tag or tags.

You can find tweaked version of Find and Replace plugin (called “Find and Replace Plus”)
here.

Using {replace_area_start}{replace_area_end} variable pair of Find and Replace Plus plugin the needed parsing order can be achieved writing the code as this:

{exp:replace_plus find="<|>" replace="<|>" multiple="yes"}
{exp
:reeposition}

{reeposition
:put_item id="first_item"}

{reeposition
:put_item id="second_item"}

{reeposition
:item id="first_item"}
<ul> First list:
{exp:weblog:entries weblog="commentary" limit="5" sort="asc" sort_by="title"}
<li>{title}</li>
{/exp:weblog:entries}
</ul>
{/reeposition:item}

{reeposition
:item id="second_item"}
<ul> Second List:
{exp:weblog:entries weblog="dictionary" limit="5" sort="asc" sort_by="title"}
<li>{title}</li>
{/exp:weblog:entries}
</ul>
{/reeposition:item}

<textarea cols="60" rows="10">
{replace_area_start}
{reeposition
:put_item id="first_item"}
{reeposition
:put_item id="second_item"}
{replace_area_end}
</textarea>

{/exp:reeposition}
{
/exp:replace_plus}

Thank you, Mr. Wilson, very very much for amazing Reeposition plugin. I cannot imagine ExpressionEngine development without it anymore!

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
   
6 of 6
6
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65086 Total Logged-in Users: 34
Total Topics: 82224 Total Anonymous Users: 23
Total Replies: 441923 Total Guests: 199
Total Posts: 524147    
Members ( View Memberlist )