News anzeigen (18)   News-Kategorien anzeigen   Archiv anzeigen (1)



Joomla Language Bootstrap Dropdown with Flags


Banner Tipps & Tricks

 

To replace the regular Joomla dropdown with a nice Bootstrap dropdown including flag icons, just copy the following code in a file called /html/mod_languages/default.php inside your template folder.
 
 
 
In your module config for the language module, set "use dropdown" and "use icons" on true.

 

/yourTemplate/html/mod_languages/default.php

<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_languages
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::_('stylesheet', 'mod_languages/template.css', array(), true);
?>
<div class="mod-languages<?php echo $moduleclass_sfx ?>">
<?php if ($headerText) : ?>
    <div class="pretext"><p><?php echo $headerText; ?></p></div>
<?php endif; ?>

<?php if ($params->get('dropdown', 1)) : ?>
    <div class="dropdown">
        <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
            <?php foreach ($list as $language) : ?>
                <?php if ($language->active):?>
                    <?php echo JHtml::_('image', 'mod_languages/' . $language->image . '.gif', $language->title_native, array('title' => $language->title_native), true);?> <?php echo $params->get('full_name', 1) ? $language->title_native : strtoupper($language->sef);?>
                        
                <?php endif;?>
            <?php endforeach;?>
            <span class="caret"></span>
        </button>
        
        <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
        <?php foreach ($list as $language) : ?>
            <?php if ($params->get('show_active', 0) || !$language->active):?>
                <li class="<?php echo $language->active ? 'lang-active' : '';?>" dir="<?php echo JLanguage::getInstance($language->lang_code)->isRTL() ? 'rtl' : 'ltr' ?>">
                    <a href="<?php echo $language->link;?>">
                    <?php if ($params->get('image', 1)):?>
                        <?php echo JHtml::_('image', 'mod_languages/' . $language->image . '.gif', $language->title_native, array('title' => $language->title_native), true);?> <?php echo $params->get('full_name', 1) ? $language->title_native : strtoupper($language->sef);?>
                    <?php else : ?>
                        <?php echo $params->get('full_name', 1) ? $language->title_native : strtoupper($language->sef);?>
                    <?php endif; ?>
                    </a>
                </li>
            <?php endif;?>
        <?php endforeach;?>
        </ul>
    </div>
<?php else : ?>
    <ul class="<?php echo $params->get('inline', 1) ? 'lang-inline' : 'lang-block';?>">
    <?php foreach ($list as $language) : ?>
        <?php if ($params->get('show_active', 0) || !$language->active):?>
            <li class="<?php echo $language->active ? 'lang-active' : '';?>" dir="<?php echo JLanguage::getInstance($language->lang_code)->isRTL() ? 'rtl' : 'ltr' ?>">
            <a href="<?php echo $language->link;?>">
            <?php if ($params->get('image', 1)):?>
                <?php echo JHtml::_('image', 'mod_languages/' . $language->image . '.gif', $language->title_native, array('title' => $language->title_native), true);?>
            <?php else : ?>
                <?php echo $params->get('full_name', 1) ? $language->title_native : strtoupper($language->sef);?>
            <?php endif; ?>
            </a>
            </li>
        <?php endif;?>
    <?php endforeach;?>
    </ul>
<?php endif; ?>

<?php if ($footerText) : ?>
    <div class="posttext"><p><?php echo $footerText; ?></p></div>
<?php endif; ?>
</div>
 

 


Was ist Joomla?
 
Joomla ist ein Content-Management-System zur Erstellung von Webseiten. Als Open Source Projekt ist Joomla nicht nur kostenlos, sondern wird auch stetig von der Community weiterentwickelt. Die Funktionen von Joomla lassen sich nach Bedarf durch Module und Plugins erweitern und eignet sich daher für Webseiten, deren Inhalte sich oft ändern oder stetig erweitert werden wie zum Beispiel Blogs oder Online Shops.
 
Bei Rückfragen kannst du dich wie immer gerne bei info@exwe.de melden.

vom 29.11.17 um 12:33




Schreibe EXWE auf WhatsApp