Hi
Here is my code
<?php
$current_cat_id=0;
?>
{exp:query sql="SELECT cat_id FROM exp_categories WHERE cat_url_title = '{segment_3}'"}
<?php
$current_cat_id='{cat_id}';
echo $current_cat_id;
?>
{/exp:query}
{exp:channel:entries channel="catalogue" dynamic="no" limit="16" paginate="both" category="<?php echo $current_cat_id;?>"}
.
.
.
.
{/exp:channel:entries}**** Setting of template: allow php: Yes PHP Parsing Stage: Output
I attach the debugger too Please help me figure out, thanks
[Mod Edit: Moved to the Dev & Programming forum]
I think the problem is that you can’t first use EE to find an id, then use php to remember the id. and then again use EE to do a new request.
1) it’s 1 time EE 2) than 1 time php 3) than endresult
So you need to use an other approach.
One solution might be, to first use EE to find the ID, and pass it to an other templates witch handels the second query.
{exp:query sql="SELECT cat_id FROM exp_categories WHERE cat_url_title = '{segment_3}’”} {embed="your_template" cat_id="{cat_id}”} {/exp:query}
In the embed template you do: {exp:channel:entries channel="catalogue" dynamic="no" limit="16" paginate="both" category="{embed:cat_id}”} RESULT {/exp:channel:entries}
Hope this helps
Hi, Thanks for your reply.
Yes, that is what I meant.
I did accordingly what you had advise, but i still facing issues.
here is my code in my “index” template {exp:query sql="SELECT cat_id FROM exp_categories WHERE cat_url_title = '{segment_3}’”} {embed="catalogue_content" cat_id="{cat_id}”} cat_id i get:{cat_id} {/exp:query}
This is the code for “catalogue_content” template {exp:channel:entries channel="catalogue" dynamic="no" limit="16" paginate="both" category="{embed:cat_id}”} {if no_results} Sorry, no result here! {/if} {/exp:channel:entries}
from my view, the code seem fine, anywhere wrong??
my output at front end for the page, it just display as {embed="catalogue_content" cat_id="11"} cat_id i get:11
please see next post for printscreen.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.