Skip to content

Add primary links to the top navigation

Thomas Kuther edited this page Nov 3, 2018 · 7 revisions

You can add external links by configuring the links and adding a template override

1. Configure external links via local config.inc.php

The list of (extenal) links can be configured in local/config/config.inc.php (e.g. with LocalFiles Editor -> Custom configuration)

See https://github.com/Piwigo/Piwigo/blob/master/include/config_default.inc.php#L133 for documentation.

Example:

$conf['links'] = array(
  'https://google.com' => 'Google',
  'https://facebook.com' => 'Facebook',
  );

2. Create a template override template for menubar_links.tpl

mkdir template-extensions/bootstrap_darkroom
cp themes/bootstrap_darkroom/template/menubar_links.tpl template-extensions/bootstrap_darkroom/

Edit the newly created template-extensions/bootstrap_darkroom/menubar_links.tpl:

{foreach from=$block->data item=link}
  <li class="nav-item">
    <a href="{$link.URL}" class="nav-link"{if isset($link.new_window)} onclick="window.open(this.href, '{$link.new_window.NAME}','{$link.new_window.FEATURES}'); return false;"{/if}>{$link.LABEL}</a>
  </li>
{/foreach}

3. Activate the override

Now, go to Administration -> Configuration -> Templates and select:

  • adjusted template: bootstrap_darkroom/menubar_links.tpl
  • original: menubar_links.tpl
  • connected theme: bootstrap_darkroom

Structures

It's possible to create structures by insterting the html code in template-extensions/bootstrap_darkroom/menubar_links.tpl.

  • Configure at least one link in $conf['links'] as shown above, so the menu gets activated
  • Remove the {foreach}..{/foreach} loop code
  • Add your own (hardcoded) structure using bootstrap 4.x nav syntax
Clone this wiki locally