gumara

เหนือกว่าเหตุผล ผมไม่มีเหตุผล

Switcher

Drupal ทำปุ่มสลับภาษา

ทำปุ่มสลับภาษา แบบไม่ต้องใช้ Block

template.php ใส่
function phptemplate_locale_block() {
$languages = language_list('enabled');
$links = array();
foreach ($languages[1] as $language) {
$links[$language->language] = array(
'href' => $_GET['q'],
'title' => $language->native,
'language' => $language,
'attributes' => array('class' => 'language-link'),
);
}

// Allow modules to provide translations for specific links.
// A translation link may need to point to a different path or use
// a translated link text before going through l(), which will just
// handle the path aliases.
drupal_alter('translation_link', $links, $_GET['q']);

$block = theme('links', $links, array());
return $block;

}

page.tpl.php ใส่
<?php print (phptemplate_locale_block());?>

กะลังหาอยู่พอดีเลย
http://drupal.in.th/node/396

rMilk

Comment

Tags

Another ~


Let's chat

User login

del.icio.us/~

tweet me

Add to Technorati Favorites


Stat:

free web tracker