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.

Getting a Next Previous Entry excerpt

May 24, 2012 10:58am

Subscribe [2]
  • #1 / May 24, 2012 10:58am

    Adam Christianson

    115 posts

    I’m currently working on a feature for our site where we want our {exp:channel:next_entry} and {exp:channel:prev_entry} links to display a small bit of text from the body channel entry field when the you hover over the title link (see attached image to see what we want it to look like). The exp:channel:next_entry and exp:channel:prev_entry provide only id, path, url, and title, variables. My first thought is to write a simple plug-in to get the results I need, but before I dive too deep I wanted to make sure there wasn’t some built-in functionality or an existing add-on that does what I need. Am I missing an obvious solution?

  • #2 / May 24, 2012 10:11pm

    ChiefAlchemist

    913 posts

    A channel:entries loop into a PHP array with the entry id being the array [key]...done.

    There might be other options but by the time you find one you could probably have yourself sorted, eh? 😊

  • #3 / May 24, 2012 11:35pm

    Adam Christianson

    115 posts

    Yeah, but I would end up with multiple channel entries tags and there is a performance hit for that right? I ended up writing a simple plug-in and it seems to work fine for my case. I’m just wondering if there is an “out-of-the-box” way. Your method does give that for sure, but I have been told channel entries is “expensive” and to avoid using multiples in a template if you can. Is that true? I know I could set caching on it though, so maybe it won’t be that bad?

  • #4 / May 25, 2012 6:58am

    ChiefAlchemist

    913 posts

    It’s expensive because under the hood a single entry is actually a # of different tables and those table need to be joined. As far as I know, this is what the disable parameter helps to manage:

    http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#disable

    If you just used a Query instead then I would think your overhead would be minimal. The other option might be to use the API.

    Somethin’ like that, eh? 😊

  • #5 / May 25, 2012 11:01am

    Adam Christianson

    115 posts

    Yup. By making a quick plugin I was able to get what i needed with a single simple query. It does have one join, but my guess is it’s more efficient than using the channel entries tag even with the ‘disable’ params.

  • #6 / May 25, 2012 11:09am

    ChiefAlchemist

    913 posts

    If you do a formal test of one v the other please share.

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

ExpressionEngine News!

#eecms, #events, #releases