Re: this mysql query with smarty
| From: | dr. zoidberg | Date: | Wed, 17 Mar 2004 15:20:23 +0000 |
| Subject: | Re: this mysql query with smarty | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11139@lists.php.net to get a copy of this message | ||
Dr. Zoidberg wrote:
My database structure is the simpliest one: +-----+--------+-------+ | id | subid | name | +-----+--------+-------+I'm googling for days but no solution. I manage to display categosries and subcategories using simple mysql query and sort data in template. Here is how my template looks like: {section name=i loop=$menu_data} {if $menu_data[i][1] eq "1"} id: {$menu_data[i][0]}<br> {section name=ii loop=$menu_data} {if $menu_data[ii][3] eq $menu_data[i][2] and $menu_data[ii][1] eq "0"} id1: {$menu_data[ii][0]}<br> {/if} {/section} {/if} {/section} Is it OK to use this many conditions in templates? -- Please do not CC me| 1 | 0 | cat |+-----+--------+-------+| 2 | 0 | cat |+-----+--------+-------+| 3 | 1 | subcat|+-----+--------+-------+| 4 | 2 | subcat|+-----+--------+-------+| 5 | 2 | subcat|+-----+--------+-------+