Hi COUCH Community.

I recently posted a request for help in the dedicated forum section. But in the meantime I found the solution by myself. If like me you try to create an editable navbar menu in the administration, I am happy to give you my solution here !

The base file is the following
I create à file called 'nav.php' and i put it in 'snippets' folder
Code: Select all
<?php require_once( '../cms.php' ); ?>

<cms:template title='Navigation' executable='0' order='9998'>
   <cms:repeatable name='navigation' label='Customize your navbar' desc='To order your item, move thumbnails and save' >
      <cms:editable name='nav_title' label='Items name' type='text' order='10' /> <!-- Example : Home -->
      <cms:editable name='nav_link' label='Internal link' type='text' order='20' /> <!-- A page of your website. Exemple : index.php -->
      <cms:editable name='nav_link_ext' label='External link' type='text' order='30' /> <!-- The address of a website. Exemple : www.sitename.xxx but without http:// -->

<?php COUCH::invoke(); ?>

After, go on your website and open this file when you're logged in SuperAdmin. "http://www.sitename.xxx/yourcouchpath/snippets/nav.php"... This action create a "Navigation" menu in admin.

Add some stuff !!! And go to the next stage :ugeek:

The navbar file
I create à file called 'navbar.php' and i put it in 'snippets' folder too
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>

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

                  <cms:pages masterpage='couch/snippets/nav.php' >
                     <cms:show_repeatable 'navigation' >

                        <!-- if internal link -->
                        <cms:if "<cms:not_empty nav_link />" >
                           <li class="nav-item<cms:if nav_link == "<cms:get 'var_name' />" > active</cms:if>">
                              <a class="nav-link" href="<cms:show k_site_link /><cms:show nav_link />"><cms:show nav_title /> <cms:if nav_link == "<cms:get 'var_name' />" ><span class="sr-only">(current)</span></cms:if></a>
                        <!-- if external link -->
                        <cms:else />
                           <li class="nav-item">
                              <a class="nav-link" target="_blank" href="http://<cms:show nav_link_ext />"><cms:show nav_title /></a>



It is not necessary to open this called 'navbar.php' file in your browser. Now, open your website base file, like 'index.php' and add the following code just bellow COUCH INVOKE code. Like this :
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

<!-- Name of the page is VERY IMPORTANT !!! -->
<cms:set var_name='index.php' />

It is really important to declare the name of your page in all your active pages

Include the 'navbar.php' in your position navbar on your website
Code: Select all
<cms:embed 'navbar.php' />

Enjoy ! :lol: :lol: :lol: