PHP Classes

File: assets/switch-templates/select.php

Recommend this page to a friend!
  Classes of mohammad anzawi  >  PHP Multilingual Support Library  >  assets/switch-templates/select.php  >  Download  
File: assets/switch-templates/select.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Multilingual Support Library
Translate texts for Web sites from JSON or DB
Author: By
Last change:
Date: 1 year ago
Size: 702 bytes


Class file image Download
<select id='<?=$id?>' class='logaty-switcher'>
    <?php foreach ($this->app->enabled() as $lang) : ?>
<option <?=($lang == logaty()->current() ? 'selected ': '')?>class='logaty-switcher__option' value='<?= $this->app->link('', $lang) ?>'>
            <?= $this->app->nameN($lang); ?>
    <?php endforeach; ?>
    window['select_element_' + '<?=$id?>'] = document.getElementById('<?=$id?>');

    window['select_element_' + '<?=$id?>'].onchange = function () {
        let elem = (typeof this.selectedIndex === undefined ? window.event.srcElement : this);
        window.location.href = elem.value || elem.options[elem.selectedIndex].value;

For more information send a message to info at phpclasses dot org.