I want to restrict channel entries based on a pre_load variable, so I am doing this:


{exp:channel:entries channel="mychannel" entry_id="{entry_id_list}" limit="10"}

But this doesn't display any entries..however, the variable {entry_id_list} does have a value (1|2) that matches he entry id.

Now, if I modify the line:


it starts displaying those entries. So, is there a format difference in what the plugin function returns back to the template where function is called?


Parse order I would think.

Preload replace is assigned and parsed in the step before plugin tags.

  1. Parse snippets / global variables, segment variables and embed variables * Parse date string constants Parse {template_edit_date} and {current_time} If present, get cached template, then go to #7
  2. Parse PHP on Input
  3. Parse simple conditionals: segment, embed, global variables
  4. Assign and parse preload_replace variables
  5. Parse module and plugin tags
  6. Parse PHP on Output Write cache file
  7. Parse advanced conditionals
  8. Process embedded templates Redirect
  9. Parse User Defined global variables and others
  10. Done

(As provided by @low)

  • You are right. preload_replace is parsed before literally anything else. See ellislab.com/expressionengine/user-guide/templates/globals/…
    – EpicVoyage
    Jan 24 '13 at 20:55
  • I'm not Deep, but he should. ;-)
    – EpicVoyage
    Jan 25 '13 at 10:38
  • Sorry, I just saw this..don't we receive email notifications when an answer is posted? :) ...ok, so if preload_replace parses as first thing then I should get the value in the variable "entry_id_list" and then use that in the channel entry loop? Actually, the variable "entry_id_list" gets the value returned from the plugin function..and I can print it anywhere in the template..but it just doesnt get accepted in the entry loop expression...any clues?
    – Deep
    Jan 26 '13 at 18:36
  • no, you won't - it parses first but you're trying to get it to parse a plugin variable within and it won't work. That why when you manually add a value to preload_replace it parses into the loop fine. Effectively what's happening is that the value for your variable is just {exp:myplugin:get_entries} rather than the entry id. Jan 26 '13 at 20:28
  • So, is there a solution to this? I need to retrieve the value of entry ids from the plugin and based on that get only those enteries..may be use php directly in the template or something else?
    – Deep
    Jan 29 '13 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.