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.

Display content based on category or result from query module

November 21, 2012 5:52am

Subscribe [1]
  • #1 / Nov 21, 2012 5:52am

    avroo

    164 posts

    I need to display content based on category or result from a custom query (query module).

    For example, when category_id = 5, no ads must be show on the page. But the problem is: the banner is outside of the channel:entries scope.

    So i came up with a custom query:

    {exp:query sql="SELECT entry_id FROM exp_category_posts WHERE entry_id='{entry_id}' AND cat_id = 5 LIMIT 1"}
     {if entry_id}
      {assign_variable:showads="false"}
     {if:else}
      {assign_variable:showads="true"}
      {/if}
    {/exp:query}

    And below:

    {if showads!="false"}
    show ads
    {/if}

    But it doesn’t work/parse the var…any other solutions?

    TIA.

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

ExpressionEngine News!

#eecms, #events, #releases