Динамическое меню (каталог) как ?

а как сделать, чтобы оно автоматом брало названия или id категорий?
Вы сейчас парите всех?
а как его интегрировать в webasyst? для чайников =)
надо взять код из index.html и вставить куда-то в шаблон? =)
Я написал как вставить меню, все остальное надо возится с кодом движка!
 
Подключил Jquery меню, но как сделать что бы оно отображало видоизмененное скриптом дерево категорий а не не произвольный Html? Сейчас у меня вот так.
Для просмотра ссылки Войди или Зарегистрируйся
А надо, что бы отображался список товаров забитый в админке.
 
Измените файл category_tree.tpl.html на это содержание:
Код:
<ul id="menu">
<li>
{section name=i loop=$categories_tree}
    {if $smarty.section.i.index >0 }
        {math equation="ver-1" assign="j" ver=$smarty.section.i.index}
        {math equation="ver2-ver1" assign="lop" ver1=$categories_tree[i].level ver2=$categories_tree[$j].level}
            {if $categories_tree[i].level < $categories_tree[$j].level}
                {if $lop>0}
                    {section name=kk loop=$lop}</li></ul>{/section}
                {/if}
            {/if}
    {/if}
            {if $categories_tree[i].slug}
                {assign var=_category_url value="?categoryID=`$categories_tree[i].categoryID`&category_slug=`$categories_tree[i].slug`"|set_query_html}
            {else}
                {assign var=_category_url value="?categoryID=`$categories_tree[i].categoryID`"|set_query_html}
            {/if}
 
<li>
<a href="{$_category_url}">{$categories_tree[i].name_ru|escape:'html'|default:"(no name)"}</a>
        {if $categories_tree[i].down==1}<ul>{else}</li>{/if}
        {if $smarty.section.i.last}
            {section name=rrr loop=$categories_tree[$j].level}</ul>{/section}
        {/if}
{/section}
</li></ul>
</div>
 
 
<script type="text/javascript">
{literal}
function initMenu() {
  $('#menu ul').hide();
  $('#menu ul').children('.current').parent().show();
  //$('#menu ul:first').show();
  $('#menu li a').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('#menu ul:visible').slideUp('slow');
        checkElement.slideDown('slow');
        return false;
        }
      }
    );
  }
$(document).ready(function() {initMenu();});{/literal}
</script>
 
<style>
{literal}
 
p {
  line-height: 1.5em;
}
 
 
ul#menu, ul#menu ul {
  list-style-type:none;
  margin: 0;
  padding: 0;
  width: 20em;
}
 
 
ul#menu a {
  display: block;
  text-decoration: none;   
}
 
 
ul#menu li {
  margin-top: 1px;
}
 
 
ul#menu li a {
  background: #c6ced0;
  color: #000000;   
  padding: 0.5em;
}
 
 
ul#menu li a:hover {
  background: #5c7681;
  color: #ffffff;
}
 
 
ul#menu li ul li a {
  background: #ccc;
  color: #000;
  padding-left: 20px;
}
 
 
ul#menu li ul li a:hover {
  background: #aaa;
border-left: 5px #000 solid;
  padding-left: 15px;
}
 
 
.code { border: 1px solid #ccc; list-style-type: decimal-leading-zero; padding: 5px; margin: 0; }
 
.code code { display: block; padding: 3px; margin-bottom: 0; }
 
.code li { background: #ddd; border: 1px solid #ccc; margin: 0 0 2px 2.2em; }
 
.indent1 { padding-left: 1em; }
 
.indent2 { padding-left: 2em; }
{/literal}
 
</style>
 
Нашел вот такой вариант горизонтального меню для Shop-Script PRO/PREMIUM

соответственно это файл category_tree.php

Код:
<table width="100%" cellspacing="1" cellpadding="5">
<tr>
 
{section name=i loop=$categories_tree}
{if $categories_tree[i].parent == 1 && $categories_tree[i].parent != 0}
 
<td style="height:38px"><a href="index.php?categoryID={$categories_tree[i].categoryID}" class="top_link">{$categories_tree[i].name}</a>
     
        <ul class="sub" style="top:39px;">
 
        {section name=j loop=$categories_tree}
          {if $categories_tree[j].parent == $categories_tree[i].categoryID}
 
          <li>
                <a href="index.php?categoryID={$categories_tree[j].categoryID}"><strong>{$categories_tree[j].name}</strong></a>
             
                {section name=k loop=$categories_tree}
                  {if $categories_tree[k].parent == $categories_tree[j].categoryID}
 
                  <a href="index.php?categoryID={$categories_tree[k].categoryID}">{$categories_tree[k].name}</a>
 
                  {/if}
                {/section}             
 
                </li>
                         
          {/if}
        {/section}
 
        </ul> 
</td>
 
{/if}
{/section}
 
</tr>
</table>

Но почему-то на webasyst он не работает! не пойму в чём причина, может у кого-то есть идеи?
 
Назад
Сверху