We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Reeposition [Was MoveIt]

Development and Programming

Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

Mr. Wilson,

Thanks for your response. I’ll give that a try and see what happens. 😊

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

Mr. Wilson. Works like a charm! Thanks for the help and the wonderful plugin. 😊

       
Mr. Wilson's avatar
Mr. Wilson
131 posts
17 years ago
Mr. Wilson's avatar Mr. Wilson

Please note that I have moved the plugin’s download location and created some very basic documentation. I will be improving the documentation for all of my EE projects over the coming months.

       
oldgoldblack's avatar
oldgoldblack
113 posts
17 years ago
oldgoldblack's avatar oldgoldblack

Brilliant! This plugin solved a long-standing, seemingly intractable problem for me. It will make many templates more efficient, to boot! Thank you very much, Mr. Wilson, sir. Don’t know how I used EE without it.

       
inoa's avatar
inoa
35 posts
17 years ago
inoa's avatar inoa

Hey, why isn’t this listed in the Plugins repository?

       
Mr. Wilson's avatar
Mr. Wilson
131 posts
17 years ago
Mr. Wilson's avatar Mr. Wilson

Because I haven’t submitted it. On my to-do list is “Clean up add-ons and submit to EE”. Reeposition is popular enough these days I should really get my rear in gear.

       
inoa's avatar
inoa
35 posts
17 years ago
inoa's avatar inoa

Looks like a very helpful plugin – thanks for your work, Mr Wilson!

       
stinhambo's avatar
stinhambo
1,268 posts
17 years ago
stinhambo's avatar stinhambo

Mr. Wilson you are a genius!!

       
Laisvunas's avatar
Laisvunas
879 posts
about 17 years ago
Laisvunas's avatar Laisvunas

Hi Mr.Wilson,

Thanks for excellent plugin. In many situations it proved to be very useful.

Here is one problem I stumbled upon using Reeposition plugin: it seems that items wchich were moved by Reeposition plugin are not available as data for other plugins.

For example, consider this code in which Reeposion plugin is used together with Find and Replace plugin:

{exp:reeposition}
{exp:weblog:entries weblog="my_weblog" limit="1" sort="asc"}

{reeposition:put_item id="first_item"} 

{reeposition:put_item id="second_item"} 

{reeposition:item id="first_item"}
Some code
{/reeposition:item}

{reeposition:item id="second_item"}
Some code
{/reeposition:item}

<textarea>
{exp:replace find="<|>" replace="&  lt;|& gt;" multiple="yes"}
{reeposition:put_item id="first_item"}
{reeposition:put_item id="second_item"}
{/exp:replace}
</textarea>

{/exp:weblog:entries}
{/exp:reeposition}

Items get moved, but the plugin Find and replace does not replace anything.

Is it possible to achieve that items moved were used as data for some other plugin? If not, what kind of changes in Reeposition or/and Find and Replace plugins might be necessary to achieve it?

       
Laisvunas's avatar
Laisvunas
879 posts
about 17 years ago
Laisvunas's avatar Laisvunas

Just found that parameter parse=”inward” added to {exp:reeposition} tag solves my problem perfectly.

Excuse me for the noise in the forum. Your plugin is just amazing.

       
Mr. Wilson's avatar
Mr. Wilson
131 posts
about 17 years ago
Mr. Wilson's avatar Mr. Wilson

Glad you got it working!

       
phatphug's avatar
phatphug
31 posts
16 years ago
phatphug's avatar phatphug

Hi Mr Wilson,

I’ve been using your plugin for only a few weeks and it works great. However I appear to be having problems with conditionals. I noticed that there can be problems with advanced conditionals, but I am only using basic ones.

I’ve simplified my template to demonstrate. Note: the weblog entry fetched for public_content contains has an empty pg_heading field

{exp:reeposition}

{!-- Fetch Input --}
{exp:weblog:entries weblog="public_content" url_title="our_people"}
    {if pg_heading != ""}
        got heading
        {reeposition:item id="pg_heading"}<h2>got heading: '{pg_heading}'</h2>{/reeposition:item}
    {/if}
    {if pg_heading == ""}
        no heading
        {reeposition:item id="pg_heading"}<h2>no heading: '{pg_heading}'</h2>{/reeposition:item}
    {/if}
{/exp:weblog:entries}

{!-- Output --}
{reeposition:put_item id="pg_heading"}
{/exp:reeposition}

Now, I would expect the above code to output “no heading” (from the exp:weblog:entries loop) and for the reeposition put_item call to output:

<h2>no heading: ''</h2>

When I run this code however, I get “no heading” (as expected) but reeposition outputs:

<h2>got heading: ''</h2>

One strange thing, is that if I swap the position of the if statements (so that pg_heading != “” is tested after pg_heading == “”) then reeposition outputs the correct statement.

It appears to me as if the {reeposition:item id="pg_heading"} calls are processed regardless of the surrounding if statements?

Of course its pointless having those two if statements, but the problem I was having initially was that reeposition would always output a heading even when the heading was an empty string.

       
Cocoaholic's avatar
Cocoaholic
445 posts
16 years ago
Cocoaholic's avatar Cocoaholic

How about this? (untested)

{exp:reeposition}

{!-- Fetch Input --}
{exp:weblog:entries weblog="public_content" url_title="our_people"}
    {reeposition:item id="pg_heading"}
    
    {if pg_heading != ""}
        got heading
        <h2>got heading: '{pg_heading}'</h2>
    {/if}
    {if pg_heading == ""}
        no heading
        <h2>no heading: '{pg_heading}'</h2>
    {/if}
    
    {/reeposition:item}
{/exp:weblog:entries}

{!-- Output --}
{reeposition:put_item id="pg_heading"}
{/exp:reeposition}
       
phatphug's avatar
phatphug
31 posts
16 years ago
phatphug's avatar phatphug

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

       
Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

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!

       
First 4 5 6 7

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.