ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Order entries by status?

November 23, 2011 1:33pm

Subscribe [3]
  • #1 / Nov 23, 2011 1:33pm

    lonelytraveller

    38 posts

    Hello,
    I’m working on a large website, it’s a daily web magazine with more or less 3000 articles/entries. On the home page my clients wants to display 3 “cover stories” + 6 featured articles.
    When I first designed the website we decided that assigning a “status” for each cover and featured article would be the easiest way for my client to manage daily content. So now I have a template that calls for entries in cover_1, cover_2, cover_3, feat_1, feat_2,... feat_6 status, and then displays them on the home page. The problem is that all these entries must be ordered by status (e.g. feat_1 must be the first one, feat_2 the second and so on), therefore I had to use 9 different “exp:channel:entries tag” which was ok when we had 1000 entries, but is obviously slowing down the db now that we have 3000 and the page takes almost 30 seconds to load the first time.

    I cached SQL queries and “exp:channel:entries” tag, and now my page is a bit faster (25”) but still incredibly slow, and the situation is going to get worse. Entry pages load fast, even if they have a lot of big images, but the problem is the home page.

    Is there any way (with or without an add-on) to reduce queries in my home page? It would be nice to order my entries by status so that I could use the “exp:channel:entries tag” just twice…

    I’m open to suggestions, and if there’s an easiest way to accomplish this task I’ll be more than happy to rewrite my code. 

  • #2 / Nov 23, 2011 3:00pm

    John St-Amand

    865 posts

    Two suggestions:

    1) to order by status - not possible currently (I wish it was), however, since you CAN order by a custom field, you could create a custom field that mimics what you would otherwise use status for.  Obviously you would want to easily be able to find, from the main edit list view, entries that have that field, so adding the awesome Zenbu to your install would give you the ability to add that pseudo-status custom field as a column in the edit view.  This way, a single entries tag pair can be used to give your “top stories” their due, while still serving the rest within the same entries call.

    2) in terms of page load speed, one addon that works wonders for that is Solspace’s Template Morsels.  It caches the output of your code in the DB and serves it from there, which is vastly faster than even caching the template itself or your entries tags, I’ve found.  It gives you options as to how you want the cache refreshed - like on submission of a new entry to the channel, or at specified time intervals, etc.  It’s worth a look for sure.

    Hope either or both suggestions help!

  • #3 / Nov 23, 2011 3:00pm

  • #4 / Nov 23, 2011 3:04pm

    John St-Amand

    865 posts

    Oh, and a related suggestion regarding ordering - I recommend Low Reorder.  It’s terrific.  Drag and drop selection of your order.  The only downside to it, at least currently, is that ordering within a channel means, in your case, a really long list to reorder. So perhaps not ideal.

    Then again, if you order by your custom field i suggested in the previous post, you may be able to accomplish the same thing by having your custom field be a drop down allowing you to select between cover1, cover2, cover3, feature1, feature2, feature3, feature4, feature5, feature6 - which when ordered by the custom field would put them in the right order.

  • #5 / Nov 23, 2011 7:07pm

    lonelytraveller

    38 posts

    Thanks for all the of useful suggestions!

    @John: you got the point! The custom field solution makes sense and Zenbu could make life easier for my client. Also Solspace’s Morsels sounds like a smart choice for such a content laden website. Regarding Low Reorder: I really like Low’s add-ons, but as you pointed out I think that my client would find this solution a bit impractical

    @Dylan: thanks a lot for suggesting Selected Items plug-in! I didn’t even know about it but it looks like the perfect solution for a daily web magazine.

    I think I’ll give both solutions a try and post the results here, as this could be useful for other users.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases