gumara

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

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

Submitted by gumara on Wed, 06/18/2008 - 15:03

ทำปุ่มสลับภาษา แบบไม่ต้องใช้ 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

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

rMilk

Comment

Tags

Another ~


Let's chat

User login

del.icio.us/~

Add to Technorati Favorites


Stat:

free web tracker