View Single Post
  #1  
Old 12-09-2008, 09:18 AM
 
Bobarra_Webmaster Bobarra_Webmaster is offline
 

Newbie
  
Join Date: Nov 2008
Posts: 9
 

Default Need help pulling subcategory descriptions into loop

Hi everyone, I am a newbie to these forums. Hope I follow etiquette correctly.

My issue:

When I'm pulling in data from the database, the data for "Description" doesn't show up. Here is my code:

Code:
{capture name=dialog} {assign var="tmp" value="0"} {foreach from=$subcategories item=c key=catid} {if $c.category}{assign var="tmp" value="1"}{/if} {/foreach} {if $subcategories} <ul id="subcategories"> {foreach from=$subcategories item=subcat} <li> {*{if $tmp and $first_subcat ne "Y"} <td valign="top" rowspan="{count value=$subcategories print="Y"}"><img src="{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/image.php?id={$cat}&amp;type=C{/if}" alt="" /></td> {assign var="first_subcat" value="Y"} {/if}*} <a href="home.php?cat={ $subcat.categoryid }"><img src="{$xcart_web_dir}/image.php?id={$subcat.categoryid}&amp;type=C" alt="" class="p_img" /></a> <p class="subcategory_p_title"><a href="home.php?cat={ $subcat.categoryid }">{ $subcat.category|escape }</a></p> <p class="subcategory_p_desc">{$subcat.description|escape}</p> </li> {/foreach} </ul> {/if}

The "{$subcat.description|escape}" isn't working, though the database is populated in that field. Is there a special way to pull in that data that isn't obvious? The other ones ({$subcat.categoryid}, etc) pull data fine.

I also tried a mod found here (http://forum.x-cart.com/showthread.php?t=384, changing it a bit to make it a <ul>, not changing the data structure though. It doesn't pull any data at all. Here's the code to that mod:

Code:
{capture name=dialog} {assign var="tmp" value="0"} {section name=cat_num loop=$subcategories} {if $subcategories[cat_num].category}{assign var="tmp" value="1"}{/if} {/section} <ul id="subcategories"> {section name=cat_num loop=$subcategories} <li> <a href="home.php?cat={$subcategories[cat_num].categoryid}"><img src="{$xcart_web_dir}/image.php?id={$subcategories[cat_num].categoryid}&amp;type=C" alt="" class="p_img" /></a> <p class="subcategory_p_title"><a href="home.php?cat={$subcategories[cat_num].categoryid}">{$subcategories[cat_num].category|escape}</a></p> <p class="subcategory_p_desc">{$categories[cat_num].description|escape}</p> </li> {/section} </ul>

Any ideas would be, of course, appreciated.

Thanks
__________________
Version 4.1.10
Reply With Quote