Jump to content

Recommended Posts

  • 2 months later...
  • 4 months later...

В Site.class.php изменить

// Разделы меню
if($this->mobile_user)
$this->db->query("SELECT * FROM sections WHERE enabled=1 AND menu_id=3 ORDER BY order_num");
else
$this->db->query("SELECT * FROM sections WHERE enabled=1 AND menu_id=2 ORDER BY order_num");
$sections = $this->db->results();
$this->smarty->assign('sections', $sections);

на

// Разделы меню
$this->db->query("SELECT * FROM sections WHERE enabled=1 AND menu_id>0 ORDER BY order_num");
$sections = $this->db->results();
$this->smarty->assign('sections', $sections);


В базе, в таблице menu создать собственно Боковое меню.


В index.tpl прописать вызов этого меню по id (например 4):

<ul>
{foreach name=sections from=$sections item=s}
{if $s->menu_id == 4}
{if $section->section_id == $s->section_id}
<li>
<span tooltip='section' section_id='{$s->section_id}'>{$s->name|escape}</span>
{else}
<a tooltip='section' section_id='{$s->section_id}' href='sections/{$s->url}'>{$s->name|escape}</a>
</li>
{/if}
{/if}
{/foreach}
</ul>

Link to post
Share on other sites
  • 5 months later...

Да но теперь каждое меню нужно менять примерно так:

<li>
{foreach from=$sections item=s}
{if $s->menu_id == 2}
<a tooltip='section' section_id='{$s->section_id}' href='sections/{$s->url}'>{$s->name|escape}</a>
{/if}
{/foreach}
</li>
</ul>

То есть мею нужно заключать в условие

{if $s->menu_id == 2}

Где 2 это и есть id меню (см. бд).
В противном случае нужное нам меню просто не будет выводится.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...