Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hi Couch community,

I actually work on a blank project Bootstrap 4 with a default template based on Couch CMS installation (install_ex.php via admin dump). Couch work fine but i need to have an editable menu (navbar).

I actually have this code (it's not the easy way i think)...

I would be able to create a repeatable area, or cloned to make a true editable navbar !

Have you some idea to reach my objective ?

I try repeatable like this

nav.php to generate admin
Code: Select all
<cms:template title='Navigation' executable='0' order='9998'>
   <cms:repeatable name='navigation' label='Édition du menu du site' desc='Pour ordonner votre menu, faites glisser les éléments à la bonne place et enregistrez' >
      <cms:editable name='nav_title' label='Nom du menu' desc='Le nom du menu' type='text' order='10' />
      <cms:editable name='nav_link' label='Lien interne' desc='Par exemple : blog.php' type='text' order='20' />
      <cms:editable name='nav_link_ext' label='Lien externe' desc='Par exemple : http://www.monsite.com' type='text' order='30' />
   </cms:repeatable>
</cms:template>


navbar.php in snippets
Code: Select all
      <nav class="navbar navbar-expand-lg navbar-light bg-light">
         <div class="container">
            <a class="navbar-brand" href="<cms:show k_site_link />"><img class="logo" src="<cms:show k_site_link />/img/becouch-logo.png" alt="becouch logo"></a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
               <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse justify-content-end" id="navbar">
               <ul class="navbar-nav">

               <cms:pages masterpage='_config/nav.php' >
                  <cms:show_repeatable 'navigation' >
                  
                  <!-- si lien interne -->
                  <cms:if "<cms:not_empty nav_link />" >
                  <li class="nav-item<cms:if k_template_name eq '<cms:show nav_link />' > active</cms:if>">
                     <a class="nav-link" href="<cms:show k_site_link /><cms:show nav_link />"><cms:show nav_title /> <cms:if k_template_name eq '<cms:show nav_link />' ><span class="sr-only">(current)</span></cms:if></a>
                  </li>
                  <!-- si lien externe -->
                  <cms:else />
                  <li class="nav-item">
                     <a class="nav-link" href="http://<cms:show nav_link_ext />"><cms:show nav_title /></a>
                  </li>
                  </cms:if>

                  </cms:show_repeatable>
               </cms:pages>

               </ul>

            </div>
         </div>
      </nav>


The code work, but, not the "active" class, the "orderby" et "order"... I think i miss a think like masterpage...
When you're right and your girl say you're just mad...
When you're right and your girl say you're just mad...
2 posts Page 1 of 1

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 4 guests

cron