Not sure if I did this right, but I tried to switch to just regular conditionals and then I am definitely running into memory issues as I get a blank page:
{exp:reeposition}
{exp:weblog:entries weblog="{current_weblog}" disable="member_data|pagination|trackbacks"}
{if entry_id == "445" || entry_id == "446" || entry_id == "483" || entry_id == "484" || entry_id == "485" || entry_id == "486" || entry_id == "487" || entry_id == "488" || entry_id == "489"}
{reeposition:item id="{entry_id}"}
{if {current_weblog_id}_motto != ""}
<li>{if {current_weblog_id}_book_status == "Dead"}{{/if}<a href="http://www.westeros.org/Citadel/Heraldry/Entry/{entry_id}/" target="Heraldry" onclick="openWindow(this.href,this.target,0,0,1,0,0,750,520,0,0); return false">{title}{if {current_weblog_id}_seat} of {{current_weblog_id}_seat}{/if}</a>{if {current_weblog_id}_book_status == "Dead"}}{/if} - {{current_weblog_id}_motto}</li>
{/if}
{/reeposition:item}
{if entry_id != "445" || entry_id != "446" || entry_id != "483" || entry_id != "484" || entry_id != "485" || entry_id != "486" || entry_id != "487" || entry_id != "488" || entry_id != "489"}
{reeposition:item group="category_{categories}{category_id}{/categories}"}
{if {current_weblog_id}_motto != ""}
<li>{if {current_weblog_id}_book_status == "Dead"}{{/if}<a href="http://www.westeros.org/Citadel/Heraldry/Entry/{entry_id}/" target="Heraldry" onclick="openWindow(this.href,this.target,0,0,1,0,0,750,520,0,0); return false">{title}{if {current_weblog_id}_seat} of {{current_weblog_id}_seat}{/if}</a>{if {current_weblog_id}_book_status == "Dead"}}{/if} - {{current_weblog_id}_motto}</li>
{/if}
{/reeposition:item}
{/if}
{/exp:weblog:entries}
Speaking of that other section, I am now trying to sort out whether Reeposition can be used for it or should be ruled out as a possible solution.
The index on this page is the goal I am working towards: http://www.westeros.org/Citadel/Concordance/
Lets say that each link in that index is made into an entry, named as the links are currently named.
Do you think Reeposition could help me create an index of these entries that is formatted just as the index currently is formatted? Since its an existing static section that I am trying to move into EE, its important for me to stay as close to the old layout as possible.
I have been trying all day to wrap my head around how one could do this, but I don’t think I am too much closer to a solution. It would be easy enough to label each ‘level’ of entries using categories or a custom status for each, but actually producing a nested index like that without having to manually lay it out seems like it would take some pretty convoluted conditionals, and that might be an issue with Reeposition given the advanced conditionals issues.
Hi all, Mr. Wilson,
I am trying to move multiple items using your wonderful Reeposition plugin, but I can’t get it to do what I want this time. The code I have right now does reposition the code, but unfortunately it shows the same (first) entry twice.
Could you tell me if this code should be working, or how I can get it to work… or is this not possible?
Cheers
Okey dokey, I took a look at this and I think I see what’s happening. Fortunately, I also have a solution. I’ll start with the solution. Change these lines:
{reeposition:item id="unique_id"}
{reeposition:item id="another_id"}
{reeposition:put_item id="unique_id"}
{reeposition:put_item id="another_id"}
to these:
{reeposition:item id="unique_id_{count}"}
{reeposition:item id="another_id_{count}"}
{reeposition:put_item id="unique_id_1"}
{reeposition:put_item id="another_id_2"}
As for an explanation, without looking into it too deeply, it looks like you’re hitting some sort of parsing order problem. At the time Reeposition runs, it is seeing the contents of both “if” blocks for both entries. That means two things. First, it means that Reeposition ends up trying to place four (2x2) different items; and second, it means that both of the put_item variables get replaced by the first entry, leaving nothing else to replace after that. (Did that make any sense?)
I will need to look deeper to determine if there’s something I can do to Reeposition to help the situation, but the only solution that comes to mind would cause problems in certain usage scenarios, so it’s out.
Thank you.
This is perfect for positioning multiple ‘blocks’ with different styles on a homepage for example.
Because the ID’s need to be unique even without the added number, I’m now using this code:
{reeposition:item id="id_1_{count}"}
{reeposition:item id="id_2_{count}"}
{reeposition:put_item id="id_1_1"}
{reeposition:put_item id="id_2_2"}
It looks a bit odd with the double numbers but this doesn’t work:
{reeposition:item id="id_{count}"}
{reeposition:item id="id_{count}"}
{reeposition:put_item id="id_1"}
{reeposition:put_item id="id_2"}
I figured it would be a parsing issue. It would be great if there was a slightly more foolproof method, but this will do for now 😊
Thanks again!
Any idea why this is not working? It does not seem to move the items, but prints out the tags (I get {reeposition:put_item id="catid"} and {reeposition:put_item id="catid"} tags displayed in the debugging).
{exp:reeposition}
{!-- Contents page of a given Target issue --}
{if segment_3 != "" AND segment_3 != "archives" AND segment_4 == NULL}
<div id="coverContainer">
<h1>Target Magazine</h1>
{exp:query sql="SELECT cat_id FROM exp_categories WHERE cat_name = '{segment_3}'"}
{exp:weblog:entries weblog="target_cover" limit="1" disable="member_data|trackbacks" category="{cat_id}"}
<div id="targetIssueNavContainer">
<div id="targetIssueNav">
Issue {categories}{exp:replace find=",SPACE" replace="SPACE/SPACE" multiple="yes"}{category_description}{/exp:replace}{/categories} / <span></td>
</tr>
</table>
{/exp:weblog:entries}
</div>
{/if}
{!-- Individual Target articles by issue --}
{if segment_4 != ""}
{exp:query sql="SELECT cat_id FROM exp_categories WHERE cat_name = '{segment_3}'"}
{exp:weblog:entries weblog="target" orderby="target_section" sort="desc" paginate="top" disable="member_data|trackbacks" category="{cat_id}"}
{reeposition:item id="articlepagination"}{paginate}{if previous_page}<a href="http://{auto_path}">Previous Page</a> {/if}{if next_page}<a href="http://{auto_path}">Next Page</a>{/if}{/paginate}{/reeposition:item}
{/exp:weblog:entries}
{/exp:query}
{exp:weblog:entries weblog="target" cache="yes" refresh="240" disable="member_data|trackbacks" url_title="{segment_4}"}
<div id="targetIssueNavContainer">
<div id="targetIssueNav">
Issue {categories}{exp:replace find=",SPACE" replace="SPACE/SPACE" multiple="yes"}{category_description}{/exp:replace}{/categories} / <span id="issueName"><a href="/resources/target/{segment_3}">{title}</a></span>
</div>
</div>
{reeposition:put_item id="articlepagination"}
{title}
{target_articletext}
{/exp:weblog:entries}
{/if}
{!-- Target archives listing --}
{if segment_3 == "archives"}
<h1>Target Magazine</h1>
<div id="targetContents">
{exp:weblog:entries weblog="target_cover" orderby="url_title" sort="desc" disable="member_data|trackbacks"}
{categories}<a href="/resources/target/{category_name}">{category_name}{/categories}</a>
{/exp:weblog:entries}
</div>
{/if}
{/exp:reeposition}
Any idea why this is not working? It does not seem to move the items, but prints out the tags (I get {reeposition:put_item id="catid"} and {reeposition:put_item id="catid"} tags displayed in the debugging).
Try changing it to this:
{paginate}{reeposition:item id="articlepagination"}{if previous_page}<a href="http://{auto_path}">Previous Page</a> {/if}{if next_page}<a href="http://{auto_path}">Next Page</a>{/if}{/reeposition:item}{/paginate}
Notice that I put the reeposition tag inside the paginate tag instead of out. The paginate tag simply defines how it will look, not where it will go; hence, trying to reposition this is an exercise in futility. However, if you reposition its contents, it should work.
EDIT: I assume this is the snippet of code you were talking about?
Thanks Arden!
That will hopefully solve one of my problems!
I was actually talking about something else, which in my haste, I hadn’t pasted in:
{!-- Contents page of latest Target issue shown if no issue selected --}
{if segment_3 == NULL}
{exp:weblog:entries weblog="target_cover" limit="1" orderby="url_title" sort="desc" disable="member_data|trackbacks"}
{categories}{reeposition:item id="catid"}{category_id}{/reeposition:item}{/categories}
<h1>Target Magazine</h1>
<div id="coverContainer">
...
</div>
{/exp:weblog:entries}
<div id="targetContents">
<h2>In this issue:</h2>
{exp:weblog:entries weblog="target" disable="member_data|trackbacks" category="{reeposition:put_item id="catid"}"}
<table>
<tr>
<td class="targetSection">{target_section}</td><td class="targetArticleTitle"><a href="http://{url_title_path=resources/target/}">{title}</a></td>
</tr>
</table>
{/exp:weblog:entries}
</div>
{/if}
What I’m trying to do is pull up the latest entry according to a sort oder, find the category that entry belongs to, then move that category ID down to the last exp:weblog:entries tag.
Well, it is a bit hard to read someone’s mind from the other side of the world : )
Yes, they are enclosed, like so:
{exp:reeposition}
{!-- Contents page of a given Target issue --}
{if segment_3 != "" AND segment_3 != "archives" AND segment_4 == NULL}
{exp:query sql="SELECT cat_id FROM exp_categories WHERE cat_name = '{segment_3}'"}
{exp:weblog:entries weblog="target_cover" limit="1" disable="member_data|trackbacks" category="{cat_id}"}
...
{/exp:weblog:entries}
<div id="targetContents">
<h2>In this issue:</h2>
{exp:weblog:entries weblog="target" disable="member_data|trackbacks" category="{cat_id}"}
...
{/exp:weblog:entries}
{/exp:query}
</div>
{/if}
{!-- Contents page of latest Target issue shown if no issue selected --}
{if segment_3 == NULL}
{exp:weblog:entries weblog="target_cover" limit="1" orderby="url_title" sort="desc" disable="member_data|trackbacks"}
{categories}{reeposition:item id="catid"}{category_id}{/reeposition:item}{/categories}
...
{/exp:weblog:entries}
<div id="targetContents">
<h2>In this issue:</h2>
{exp:weblog:entries weblog="target" disable="member_data|trackbacks" category="{reeposition:put_item id='catid'}"}
...
{/exp:weblog:entries}
</div>
{/if}
{!-- Individual Target articles by issue --}
{if segment_4 != ""}
{exp:query sql="SELECT cat_id FROM exp_categories WHERE cat_name = '{segment_3}'"}
{exp:weblog:entries weblog="target" orderby="target_section" sort="desc" paginate="top" disable="member_data|trackbacks" category="{cat_id}"}
{paginate}{reeposition:item id="articlepagination"}{if previous_page}<a href="http://{auto_path}">Previous Page</a> {/if}{if next_page}<a href="http://{auto_path}">Next Page</a>{/if}{/reeposition:item}{/paginate}
{title}
{/exp:weblog:entries}
{/exp:query}
{exp:weblog:entries weblog="target" cache="yes" refresh="240" disable="member_data|trackbacks" url_title="{segment_4}"}
...
{reeposition:put_item id="articlepagination"}
...
{/exp:weblog:entries}
{/if}
{!-- Target archives listing --}
{if segment_3 == "archives"}
<h1>Target Magazine</h1>
<div id="targetContents">
{exp:weblog:entries weblog="target_cover" orderby="url_title" sort="desc" disable="member_data|trackbacks"}
...
{/exp:weblog:entries}
</div>
{/if}
{/exp:reeposition}
(Re, the pagination, I think it is related to this)
Thanks again.
Oh, I think I see why you might be having a problem. You’re trying to get the category ID for one entry and stick it into another. I think you’re running into the Wall of Parse Order. Can you post a link, as well as the output from turning on template debugging? It would be immensely helpful to be able to study the parsing order of your templates and try to determine a workaround.
(0.000032) - Begin Template Processing -
(0.000253) URI: /resources/target/
(0.000270) Path.php Template: /
(0.000292) Retrieving Template
(0.000311) Parsing Template URI
(0.025171) Determined Template: resources/target
(0.025221) Retrieving Template from Database: resources/target
(0.030735) Template Found
(0.035618) Retrieving Template from File
(0.036461) Template Type: webpage
(0.036890) Parse Date Format String Constants
(0.037009) Parse Current Time Variables
(0.037234) Parsing PHP on Input
(0.037519) Parsing Segment, Embed, and Global Vars Conditionals
(0.040145) - Beginning Tag Processing -
(0.040175) Parsing Tags in Template
(0.040226) Tag: {exp:reeposition}
(0.040305) Closing Tag Found
(0.040465) Tag: {exp:weblog:entries weblog="resources" limit="6" cache="yes" refresh="60" orderby="title" sort="asc" disable="categories|member_data|trackbacks"}
(0.040673) Closing Tag Found
(0.046336) Processing Tags
(0.046403) Plugin Tag: Reeposition/reeposition
(0.046428) Module Tag: Weblog/entries
(0.047099) Including Files for Tag and Modules
(0.077182) Beginning Final Tag Data Processing
(0.077222) Calling Class/Method: Reeposition/reeposition
(0.077256) Nested Plugins in Tag, Parsing Outward First
(0.000045) Tag: {exp:query sql="SELECT cat_id FROM exp_categories WHERE cat_name = ''"}
(0.000074) Closing Tag Found
(0.000303) Tag: {exp:weblog:entries weblog="target_cover" limit="1" orderby="url_title" sort="desc" disable="member_data|trackbacks"}
(0.000465) Closing Tag Found
(0.000572) Tag: {exp:weblog:entries weblog="target" disable="member_data|trackbacks" category="{reeposition:put_item id='catid'}
(0.000753) Closing Tag Found
(0.000836) Module Tag: Query/query
(0.000860) Module Tag: Weblog/entries
(0.000882) Module Tag: Weblog/entries
(0.000904) Including Files for Tag and Modules
(0.004113) Beginning Final Tag Data Processing
(0.004143) Calling Class/Method: Query/query
(0.004645) -> Class Called: Query
(0.018941) Returning No Results Content
(0.018980) -> Method Called: query
(0.018998) -> Data Returned
(0.019038) Calling Class/Method: Weblog/entries
(0.019130) Assigning Related Entry Data
(0.020205) -> Class Called: Weblog
(0.020278) -> Method Called: entries
(0.169987) -> Data Returned
(0.170027) Calling Class/Method: Weblog/entries
(0.170378) -> Class Called: Weblog
(0.170436) -> Method Called: entries
(0.179057) Returning No Results Content
(0.179088) -> Data Returned
(0.000081) Tag: {exp:replace find=",SPACE" replace="SPACE/SPACE"}
(0.000233) Closing Tag Found
(0.000324) Tag: {exp:weblog:categories weblog="target_cover" style="linear" dynamic="off"}
(0.000435) Closing Tag Found
(0.000534) Plugin Tag: Replace/replace
(0.000559) Module Tag: Weblog/categories
(0.000579) Including Files for Tag and Modules
(0.003066) Beginning Final Tag Data Processing
(0.003128) Calling Class/Method: Replace/replace
(0.003222) -> Class Called: Replace
(0.003288) -> Method Called: replace
(0.003307) -> Data Returned
continuing…
(0.003344) Calling Class/Method: Weblog/categories
(0.003478) -> Class Called: Weblog
(0.003541) -> Method Called: categories
(0.009758) -> Data Returned
(0.266766) -> Class Called: Reeposition
(0.266901) -> Method Called: reeposition
(0.266920) -> Data Returned
(0.266974) Calling Class/Method: Weblog/entries
(0.267121) -> Class Called: Weblog
(0.267172) -> Method Called: entries
(0.326206) -> Data Returned
(0.331378) - End Tag Processing -
(0.331404) Processing Advanced Conditionals
(0.333084) - Processing Sub Templates (Depth: 1) -
(0.333117) List of Embeds: includes/head,includes/nav_top loc=resources,includes/subnav_target
(0.333167) Processing Sub Template: includes/head
(0.333190) Retrieving Template
(0.333214) Retrieving Template from Database: includes/head
(0.337985) Template Found
(0.338066) Retrieving Template from File
(0.338482) Template Type: webpage
(0.338852) Parse Date Format String Constants
(0.338900) Parse Current Time Variables
(0.338953) Parsing Segment, Embed, and Global Vars Conditionals
(0.339088) - Beginning Tag Processing -
(0.339110) - End Tag Processing -
(0.339352) Processing Sub Template: includes/nav_top
(0.339376) Retrieving Template
(0.339398) Retrieving Template from Database: includes/nav_top
(0.343626) Template Found
(0.343789) Retrieving Template from File
(0.347766) Template Type: webpage
(0.347952) Embed Variables (Keys): loc
(0.347971) Embed Variables (Values): resources
(0.348059) Parse Date Format String Constants
(0.348101) Parse Current Time Variables
(0.348169) Parsing Segment, Embed, and Global Vars Conditionals
(0.348939) - Beginning Tag Processing -
(0.348964) - End Tag Processing -
(0.349014) Processing Advanced Conditionals
(0.350281) Processing Sub Template: includes/subnav_target
(0.350306) Retrieving Template
(0.350330) Retrieving Template from Database: includes/subnav_target
(0.355967) Template Found
(0.356064) Retrieving Template from File
(0.356190) Template Type: webpage
(0.356538) Parse Date Format String Constants
(0.356687) Parse Current Time Variables
(0.356806) Parsing Segment, Embed, and Global Vars Conditionals
(0.358535) - Beginning Tag Processing -
(0.358613) Parsing Tags in Template
(0.358649) Tag: {exp:weblog:entries weblog="target_cover" limit="4" orderby="url_title" sort="desc" show_future_entries="no" show_empty="no"}
(0.358831) Closing Tag Found
(0.358916) Processing Tags
(0.358961) Module Tag: Weblog/entries
(0.358984) Including Files for Tag and Modules
(0.359005) Beginning Final Tag Data Processing
(0.359026) Calling Class/Method: Weblog/entries
(0.359302) -> Class Called: Weblog
(0.359372) -> Method Called: entries
(0.400683) -> Data Returned
(0.400993) - End Tag Processing -
(0.401153) Processing Advanced Conditionals
(0.402459) - End Template Processing -
(0.402463) Parse Global Variables
(0.410971) Template Parsing Finished
Memory Usage: 5,103,432 bytes
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.