I don’t know if anybody else will find this useful, but I whipped this up for myself and figured I may as well release it. The MoveIt plugin allows you to move content from Point A to Point B. Sounds pretty boring, doesn’t it? Yeah, well, it is. But it is useful for those situations in which you want to have content from a single {exp:weblog:entries} tag pair appear in two different places, but you don’t want the overhead of calling the weblog module twice. Sample usage:
Sorry, Derek. I actually thought about Movee, but I was afraid it would mislead people (“What, it’s not a NetFlix plugin?!”). I do like Reeposition, though…
Can I get an Amen on rechristening it Reeposition?
You would ask that, wouldn’t you? About all I’m willing to say at this point is that it’s moving forward. I don’t plan to be quite as secretive as Rick & Co. in regard to timelines and that sort of thing—in part because I need you folks to kick my butt along a bit—but it’s still too early for any details.
Cool!!!
One question, will this work for repositioning the pagination links?
You helped me with that once and this sounds similar but in plugin format.
Very cool. I can think of a few times in the past where something like this would have been handy. Like PXLated mentioned on the Pagination links. I can’t remember how many times I’ve wanted those someplace else.
Hmm, I hadn’t thought about moving pagination links, but there’s no reason it shouldn’t work. If you get it to work, would you mind posting your code (or pseudo-code) here for others to see?
Better yet, I’ll save you the work. Here’s some pseudo code that works with pagination links:
{exp:moveit} {exp:weblog:entries weblog="weblog" limit="15" paginate="top"} <h1>{title}</h1> {blog_body} {paginate} {moveit:moveme}<p>Page {current_page} of {total_pages} pages {pagination_links}</p>{/moveit:moveme} {/paginate} {/exp:weblog:entries} <h2>Move it to here:</h2> {moveit:movetohere} {/exp:moveit}
That’s obviously a very nekkid example, but it works. Just make sure you put the {moveit:moveme} tag pair inside the {paginate} tags, and you’re golden.
Add an onload event handler to the body tag: <body onload=“movePagination()”>
Put the pagination links inside a <div id=“pagination_hidden”>, and style that with CSS to be hidden (display: none;). Put <div id=“pagination”></div> wherever you want the pagination to display in the markup, and everything should work itself out. I’m (Derek) using innerHTML instead of DOM scripting nodes, because even though it’s not part of the all-wise W3C’s specs, every browser supports it, and it’s about 10 times faster than node-based read/writes.
Randy, I was really hoping that you would be unable to find that mess. The JavaScript method, being client side, takes the burden off of the server for doing it. But geeze, it’s a very very simple string replacement going on in Mr. Wilson’s plugin, and doesn’t require any special markup.
{exp:reeposition} {reeposition:item id="unique_id"}thing_you_want_to_move{/reeposition:item} {reeposition:item id="another_id"}another_thing_you_want_to_move{/reeposition:item} ... Other stuff in your web page ...
Shoot, there was a typo in the version I just posted that caused some variables not to be replaced. We’ll just call that one a beta version, how ‘bout that? Anyway, it’s fixed now.