Hi Richard,
Hope you had a good time in Spain!
Sure you can. That’s what the depthX_start_count and depthX_end_count variables are for.
Could you post exactly what code you want to produce and what the category structure looks like?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
June 16, 2011 3:06pm
Subscribe [5]#31 / Jul 26, 2011 7:43pm
Hi Richard,
Hope you had a good time in Spain!
Sure you can. That’s what the depthX_start_count and depthX_end_count variables are for.
Could you post exactly what code you want to produce and what the category structure looks like?
#32 / Jul 27, 2011 5:21am
Hi Leon,
Don’t worry, got it working this morning. Here’s the code I used:
{exp:gwcode_categories channel="industries" style="linear"}
{if cat_count == 1}
<div class="group">
{/if}
<div class="col">
<h3><a href="http://{path=industries/{cat_url_title}}">{cat_name}</a></h3>
<p> <ul><br />
{embed="_includes/x_ind_menu" catid="{cat_id}" caturl="{cat_url_title}"}<br />
</ul><br />
</div><br />
{if cat_count == 3}<br />
</div><br />
<div class="group"><br />
{/if}<br />
{if cat_count == 6}<br />
</div><br />
{/if}<br />
{/exp:gwcode_categories}My embed looked like this:
{exp:channel:entries channel="industries" disable="pagination" orderby="title" sort="asc" category="{embed:catid}"}
<li><a href="http://{title_permalink=industries/{embed:caturl}}">{title}</a></li>
{/exp:channel:entries}Really appreciate all your help.
Cheers, Richard
#33 / Jul 27, 2011 5:38am
No problem Richard, good to hear you got it working!
#34 / Jun 07, 2013 12:56am
I’m trying to accomplish this same type of drop down menu system and I’m encountering issues as this thread describes.
Any guidance or help would be appreciated. I tried following example 11 but my code kept closing prematurely too. So I switched to using has_children in an if/then - it works - but it throws an error.
{exp:gwcode_categories channel="products" excl_cat_id="11" show_empty="no" style="linear" status="open"}
{if depth == 1}
<li{if has_children} class="has-dropdown"{/if}>
<a href="http://{site_url}shop/{complete_path}">{cat_name}</a>
{if has_children}<!-- {depth} -->{if:else}</li><!-- {depth} -->{/if}
{/if}
{if depth2_start}
<ul class="dropdown">
{/if}
{if depth == 2}
<li><a href="http://{site_url}shop/{complete_path}">{cat_name}</a></li>
{/if}
{if depth2_end}
</ul>
</li><!-- {depth} -->
{/if}
{/exp:gwcode_categories}
The error I’m getting, and I think it’s related to the has_children when no subcategories exist…
A PHP Error was encountered
Severity: User Warning
Message: Invalid EE Conditional Variable: {if "1"2_start}
Filename: libraries/Functions.php
Line Number: 2749