I was having an issue where using a “display_order” field, with values of 100, 200, 300, etc. weren’t ordering properly.
I had entries with values 200 - 700. I then added a new entry and gave it a display_order value of 100, which should have made it show up first. It always showed up last. orderby=”display_order” sort=”asc” was the code.
I tried everything, deleting and re-entering the new entry, double-checking template code, I couldn’t get it to not show up last. I was also writing out the value of the field in the template as an HTML comment to check. Sure enough, 200-700 were first, then 100 came last. ??
I then gave up and used the great SelectedItems module/extension. This solved the above problem, as the items were ordered as specified in the module. However, a weird switch behavior came up.
Using {switch="blank|clearer"}, the first 2 entries contained the “blank” switch value, then the rest alternated properly as expected while using the switch variable.
You can see the page in question here: http://www.ser.com/about/management-team
Any ideas?
BTW, this site is running 1.5.2 build 20070122. I cannot undertake upgrading this site at this time.
EDIT:
Here’s my template code for this bit:
<div class="team">
{exp:selecteditems name="mgmt_team"}
{exp:weblog:entries weblog="team" entry_id="{selecteditems_id}" orderby="selecteditems"}
<div class="col">
<a href="http://{title_permalink=">{if team_photo}{team_photo}{if:else}/xres/images/common/no-image.jpg{/if}</a>
<h2><a href="http://{title_permalink=">{team_name}</a></h2>
<h3>{if team_title}{team_title}{/if}</h3>
</div>
<div class="{switch="blank|clearer"}"></div>
{/exp:weblog:entries}
{/exp:selecteditems}
</div>
Ok, I think I know what’s going on with the current situation. SelectedItems is re-ordering these after the switch code is written. So, basically, I don’t think you can use switch with that module.
BUT, it still doesn’t explain the first bit about why, when I was using display_order field to order them, the 100 was showing up behind 200-700.
Ideas?
Thanks for the pointer, Andrew. jtnt, not sure why the order was goofing with 100- it makes no sense. To debug, I’d probably start by running some queries- see what they return. That would help us narrow down the issue. Not sure you’re up for that, but if you are, say the word and we can start hitting it.
I have two usages of Selected Items extension on the same page and one works, but the other one does not. It seems to list entries in the order of the edit tab in back end.
Here is the code (not working) (this page is embedded in a full-page):
<table id="featured" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td align="center" valign="top">
{exp:selecteditems name="paintings_display_order"}
{exp:weblog:entries weblog="paintings_weblog" entry_id="{selecteditems_id}" orderby="selecteditems" limit="1" status="open"}
<div class="featured-painting">{painting-img}</div>
{entry_id}
{selecteditems_id}
<div class="featured_stats"><strong>{title}</strong>
{painting-medium} {painting-width} X {painting-height} {painting-year}
{painting-status} {painting-holder}</div>
{/exp:weblog:entries}
{/exp:selecteditems}
</td>
<td align="center" valign="top" width="200">
{embed="site/thumbs"} <<<<<-- THIS IS THE PAGE BELOW >>>>
</td>
</tr>
</table>
And here is the site/thumbs embedded page within this one highlighted above. The selected items extension ordering here works, but not above! Go figure…scratching my head.
<div id="paintingthumbs">
{exp:selecteditems name="paintings_display_order"}
{exp:weblog:entries weblog="paintings_weblog" entry_id="{selecteditems_id}" orderby="selecteditems" dynamic="off" status="open" disable="trackbacks|member_data|pagination"}
<div class="thethumbs">
<a href="http://{url_title_path=site/paintings}#{url_title}">{painting-thumb}</a>
</div>
{/exp:weblog:entries}
{/exp:selecteditems}
</div>
I found why it was not working. Apparently I am not able to use the limit=”” parameter with selected items. When I take it out, it lists the entries in the correct order. When I add, with limit=1, =2 or =20 it does not order correctly (or seems to default to the order in the back end (date).
Anyone else have this problem? I really need some way of ordering entries. I’ve tried reeorder and it’s great, but not going to work for what I need.
Hi Joel,
Due to the way that the SelectedItems module works, you cannot use the limit parameter.
You might be able to limit the entries that show using something like:
{if selecteditems_count < 5} … {/if}
If you try this and it does not work let me know. There was a bug (that has been fixed), but I’m not sure whether it was in the last ‘release’.
Andrew
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.