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.

Using entry-id as a parameter in the channel module.

July 03, 2012 5:53am

Subscribe [2]
  • #1 / Jul 03, 2012 5:53am

    gents agency

    16 posts

    I’ve been trying to filter channel entries by using the entry_id parameter. I’m using a snippet to determine the id’s.

    The snippet itself outputs: 33|69|66|59|63|65|68|32|35|39|40|63|65|68
    The entres tag looks like this: {exp:channel:entries channel="news" entry_id="{sql_limiet}”}
    I’ve tried this: {exp:channel:entries channel="news" entry_id="33"} (no success)

    I’ve checked the id’s, I’ve checkend the parsing order, I’ve tried it without the snippet, just hardcoded. And I still have no clue…

    Is there anyone having the same issue?

  • #2 / Jul 03, 2012 6:06am

    mark186282

    290 posts

    start by focusing on the hard-coded test (don’t worry about the snippet, parse order, etc…)

    {exp:channel:entries channel=“news” entry_id=“33”}

    can you provide the code from this starting tag through the closing {/exp:channel:entries} tag?

    do you have dynamic turned off (this can cause a lot of confusion if you’ve got any segment variables in the URL)

    Once we have your testing code working, it’ll be pretty simple to bring the snippet back into play and show all the entries.

  • #3 / Jul 03, 2012 6:15am

    gents agency

    16 posts

    Well,

    I’ve used this one hard coded, and it works:

    {exp:channel:entries channel="news" disable="category_fields|member_data" dynamic="no" entry_id="33|69|66|59|63|65|68|32|35|39|40|63|65|68"}{/exp:channel:entries}

    When I use this, it doesn’t:

    {exp:channel:entries channel="news" disable="category_fields|member_data" dynamic="no" entry_id="{sql_limiet}"}{/exp:channel:entries}

    This one also works:

    {exp:channel:entries channel="news" disable="category_fields|member_data" dynamic="no" orderby="date" limit="{segment_3}" offset="{segment_2}" entry_id="33|69|66|59|63|65|68|32|35|39|40|63|65|68"}{/exp:channel:entries}

    Using it with the snippet, it fails again.

    I’ve put the snippet beween <span> tags in the template itself, to be sure there were no spaces or line breakes. And there aren’t any.

  • #4 / Jul 03, 2012 6:20am

    mark186282

    290 posts

    (smells like a parse-order issue, to me)

    how are the entry_ids being gathered in the snippet?

    if you go in the snippet and hard-code the sequence of IDs, does that work?  (if that works, and the current snippet does not… then it’s probably a parse-order issue.  The entry ids might be making it to the parent template, but too late to be processed by the channel entries tag… but not too late to be displayed in the browser between the span tags.

  • #5 / Jul 03, 2012 7:13am

    gents agency

    16 posts

    Putting the id sequence in the snippet fixed it.

    In the original snippet, I used the query module.
    Now I’m using the EE database class in php. It outputs the same sequence. But it seems even the php is parsed to late.

    Is that possible?

  • #6 / Jul 03, 2012 7:20am

    gents agency

    16 posts

    The template itself also parses php. But after the EE tags are being parsed. Does this have the same effect on the snippets I use in the template?

  • #7 / Jul 04, 2012 11:21am

    Dan Decker

    7338 posts

    Hi Gents Agency,

    It is indeed a parsing order issue. The defacto reference, ExpressionEngine’s Parse Order, can give us some clues.

    Having your Query code in the snippet means the *code* for the query module will be expanded in the template very early, however, the Module itself is ran later in the order, same as always. For clarity, the snippet being expanded into the template does not cause the module code to run.

    It may be a round about way of getting there, but you could try using your snippet as an embed variable. That would pass the results of the query into the embedded template as the list of entry_ids and the embed would run the channel entries pair.

    Not exactly elegant, but it should get around the parse order issue.

    Your other option would be to write a quick plugin that could do the work of the snippet/php.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases