Custommenu プラグインを多言語サイトで使う

提供: GeeklogJpWiki

Customemenu プラグイン

custom_phpmenuitem.php を作成してlib-custom.phpから呼ぶ



事例

http://amusa.cl

phpmenuitem_home2 など、関数名をCustommenu プラグインの管理画面で指定します。

<?php

if (strpos(strtolower($_SERVER['PHP_SELF']), 'custom_phpmenuitem.php') !== false) {
    die('This file can not be used on its own!');
}

function phpmenuitem_home2()
{
    Global $_CONF, $LANG01;

    $url = $_CONF['site_url'] . '/';

    switch( COM_getLanguageId() ){
      case en: $label = '<i class="uk-icon-home"></i> HOME'; break;
      case es: $label = '<i class="uk-icon-home"></i> INICIO'; break;
      case ja: $label = '<i class="uk-icon-home"></i> HOME'; break;
      case zh: $label = '<i class="uk-icon-home"></i> HOME'; break;
    }
    
    $menuitems = array(
        'url'        => $url,
        'label'      => $label,
        'icon_url'   => '',
        'id_name'    => '',
        'class_name' => '',
        'submenu_entries' => array(),
    );
    return $menuitems;
}

function phpmenuitem_information()
{
    global $_CONF, $LANG01;

    $url = $_CONF['site_url'] . '/databox/category.php/information/code';


    switch( COM_getLanguageId() ){
      case en: $label = "NEWS"; break;
      case es: $label = "TOPICOS"; break;
      case ja: $label = "お知らせ"; break;
      case zh: $label = "新闻中心"; break;
    }
    
    $menuitems = array(
        'url'        => $url,
        'label'      => $label,
        'icon_url'   => '',
        'id_name'    => '',
        'class_name' => '',
        'submenu_entries' => array(),
    );
    return $menuitems;
}


function phpmenuitem_ourproject()
{
    global $_CONF, $LANG01;

    $url = $_CONF['site_url'] . '/databox/data.php/ourproject_' . COM_getLanguageId().'/code';


    switch( COM_getLanguageId() ){
      case en: $label = "Our Project"; break;
      case es: $label = "Nuestro Proyecto"; break;
      case ja: $label = "プロジェクト"; break;
      case zh: $label = "Our Project"; break;
    }
    
    $menuitems = array(
        'url'        => $url,
        'label'      => $label,
        'icon_url'   => '',
        'id_name'    => '',
        'class_name' => '',
        'submenu_entries' => array(),
    );
    return $menuitems;
}

function phpmenuitem_elearning()
{
    global $_CONF, $LANG01;

    $url = $_CONF['site_url'] . '/databox/data.php/elearning_' . COM_getLanguageId().'/code';


    switch( COM_getLanguageId() ){
      case en: $label = "E-LEARNING"; break;
      case es: $label = "E-LEARNING"; break;
      case ja: $label = "eラーニング"; break;
      case zh: $label = "E-LEARNING"; break;
    }
    
    $menuitems = array(
        'url'        => $url,
        'label'      => $label,
        'icon_url'   => '',
        'id_name'    => '',
        'class_name' => '',
        'submenu_entries' => array(),
    );
    return $menuitems;
}

function phpmenuitem_policy()
{
    global $_CONF, $LANG01;

    $url = $_CONF['site_url'] . '/databox/data.php/policy_' . COM_getLanguageId().'/code';


    switch( COM_getLanguageId() ){
      case en: $label = "POLICY"; break;
      case es: $label = "POLÍTICA"; break;
      case ja: $label = "ポリシー"; break;
      case zh: $label = "POLICY"; break;
    }
    
    $menuitems = array(
        'url'        => $url,
        'label'      => $label,
        'icon_url'   => '',
        'id_name'    => '',
        'class_name' => '',
        'submenu_entries' => array(),
    );
    return $menuitems;
}

function phpmenuitem_aboutus()
{
    global $_CONF, $LANG01;

    $url = $_CONF['site_url'] . '/databox/data.php/aboutus_' . COM_getLanguageId().'/code';


    switch( COM_getLanguageId() ){
      case en: $label = "ABOUT US"; break;
      case es: $label = "QUIÉNES SOMOS"; break;
      case ja: $label = "ごあんない"; break;
      case zh: $label = "关于我们"; break;
    }
    
    $menuitems = array(
        'url'        => $url,
        'label'      => $label,
        'icon_url'   => '',
        'id_name'    => '',
        'class_name' => '',
        'submenu_entries' => array(),
    );
    return $menuitems;
}

function phpmenuitem_graph()
{
    global $_CONF, $LANG01;

    $url = $_CONF['site_url'] . '/databox/data.php/graph_' . COM_getLanguageId().'/code';


    switch( COM_getLanguageId() ){
      case en: $label = "GRAPH"; break;
      case es: $label = "GRAFICOS"; break;
      case ja: $label = "グラフ"; break;
      case zh: $label = "GRAPH"; break;
    }
    
    $menuitems = array(
        'url'        => $url,
        'label'      => $label,
        'icon_url'   => '',
        'id_name'    => '',
        'class_name' => '',
        'submenu_entries' => array(),
    );
    return $menuitems;
}

function phpmenuitem_access()
{
    global $_CONF, $LANG01;

    $url = $_CONF['site_url'] . '/staticpages/index.php/access_' . COM_getLanguageId().'';


    switch( COM_getLanguageId() ){
      case en: $label = "ACCESS"; break;
      case es: $label = "ACCESO"; break;
      case ja: $label = "アクセス"; break;
      case zh: $label = "ACCESS"; break;
    }
    
    $menuitems = array(
        'url'        => $url,
        'label'      => $label,
        'icon_url'   => '',
        'id_name'    => '',
        'class_name' => '',
        'submenu_entries' => array(),
    );
    return $menuitems;
}

function phpmenuitem_contact()
{
    global $_CONF, $LANG01;

    $url = $_CONF['site_url'] . '/staticpages/index.php/contact_' . COM_getLanguageId().'';


    switch( COM_getLanguageId() ){
      case en: $label = "CONTACT"; break;
      case es: $label = "CONTACTO"; break;
      case ja: $label = "お問い合わせ"; break;
      case zh: $label = "联系我们"; break;
    }
    
    $menuitems = array(
        'url'        => $url,
        'label'      => $label,
        'icon_url'   => '',
        'id_name'    => '',
        'class_name' => '',
        'submenu_entries' => array(),
    );
    return $menuitems;
}


個人用ツール