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.

interpalating a preload_replace in an exp:channel:entries query in 2.1 (it worked in 1.69)

October 27, 2010 4:49am

Subscribe [3]
  • #1 / Oct 27, 2010 4:49am

    ryestew

    19 posts

    This used to work in 1.69 I’m not sure why its choking here.

    
    
    

    Its choking on this part: category=”{cat_id}&{visitor_cat}”

    I have php on the page and the php is set to run on the intake.  The php is setting the {visitor_cat} preload_replace variable.  But it looks like the {exp:channel:entries tag gets interpreted before the php does.  Could this be true?  If so how do you pass a variable into a {exp:channel:entries query?

  • #2 / Oct 27, 2010 10:37am

    Sue Crocker

    26054 posts

    Have you considered a snippet, or an embed?

  • #3 / Oct 27, 2010 2:06pm

    ryestew

    19 posts

    Snippets look like a php include file?  If so won’t help.  I need a variable.  A php variable is fine but its not working I think because the nested exp:channel:entries line is getting interpreted too soon.  Of course I don’t totally buy this theory.

    But if I use a php variable like this

    channel=”{article}” category=”{cat_id}&<?=visitor_cat?>”  it still chokes.  If I don’t use the php variable it works fine.  If I use a preload_replace (which is set by the php variable on the top of the page) it also does not work.

  • #4 / Oct 27, 2010 2:13pm

    ryestew

    19 posts

    I think I solved it by making the php var have an ampersand in it.

    $visitor_cat_plus = "&".$visitor_cat

    and the query is now

    {exp:channel:entries channel="{article}" category='{cat_id}<?=$visitor_cat_plus?>' dynamic="no" disable="member_data|pagination"}
  • #5 / Oct 27, 2010 2:55pm

    Ingmar

    29245 posts

    Great solution 😊 Please post again in case there’s anything else.

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

ExpressionEngine News!

#eecms, #events, #releases