We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Help with Embedding {exp:channel:entries} inside a query

Development and Programming

ovation01's avatar
ovation01
42 posts
13 years ago
ovation01's avatar ovation01

I’m trying to use exp:query and having trouble embedding {exp:channel:entries} tag within it.

The goal of my code: - Pull a custom member field from the URL ({segment_3}) - Use {exp:query} to look at that custom field in the URL and find the user’s group_id - If the group_id matches, then display the contents of {exp:channel:entries}

What’s working: - I can get the query to recognize the custom field, and to grant permission based on group_id, and display anything NOT within the {exp:channel:entries}

What’s broken: - Once we’ve validated group_id, I cannot get it to display the contents of {exp:channel:entries}

Interesting Note: I am using a custom field in the query ({segment_3}). If I changed this to a built-in field, like username, then the {exp:channel:entries} data displays just fine.

The broken code:

{exp:query sql="
SELECT m_field_id_3, group_id, a.member_id
FROM exp_member_data a
JOIN exp_members b 
ON a.member_id=b.member_id
WHERE m_field_id_3='{segment_3}'
"}

{if group_id=='8'}

{exp:channel:entries channel='audio' category='219|220|259' rdf='off' limit='44' start_on='2012-09-01 12:00 am' show_future_entries='yes' show_expired='no' } 
{title}<br>
{/exp:channel:entries}

<item>
<title>{exp:xml_encode}TEST HEADLINE{/exp:xml_encode}</title>
<description>{exp:xml_encode}THIS IS A TEST ITEM THAT IS NOT CONTAINED INSIDE EXP:CHANNEL:ENTRIES {/exp:xml_encode}</description>
 </item>

{/if} 

{/exp:query}

Any idea?

       
Gareth Davies's avatar
Gareth Davies
491 posts
13 years ago
Gareth Davies's avatar Gareth Davies

Double post, but replied here: http://ellislab.com/forums/viewthread/230873/#1044257

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.