多语言幻灯片

时间:2014-03-06 15:03:50

标签: php html

我在drupal 7,nexus 7.x-1.3主题中有幻灯片显示代码。

我的网站是多语言的,我需要为每种语言使用不同的图像,即我想用(gr语言)的其他图像名称更改slide-image-1.jpg(en语言)。那有什么解决方案吗?谢谢。

 <?php if ($is_front): ?>
    <?php if (theme_get_setting('slideshow_display','nexus')): ?>
      <?php 
    $slide1_head = check_plain(theme_get_setting('slide1_head','nexus'));   $slide1_desc = check_markup(theme_get_setting('slide1_desc','nexus'), 'full_html'); $slide1_url = check_plain(theme_get_setting('slide1_url','nexus'));
    $slide2_head = check_plain(theme_get_setting('slide2_head','nexus'));   $slide2_desc = check_markup(theme_get_setting('slide2_desc','nexus'), 'full_html'); $slide2_url = check_plain(theme_get_setting('slide2_url','nexus'));
    $slide3_head = check_plain(theme_get_setting('slide3_head','nexus'));   $slide3_desc = check_markup(theme_get_setting('slide3_desc','nexus'), 'full_html'); $slide3_url = check_plain(theme_get_setting('slide3_url','nexus'));
  ?>

<div id="slidebox" class="flexslider">
<ul class="slides">
  <li>
    <img src="<?php print base_path() . drupal_get_path('theme', 'nexus') . '/images/slide-image-1.jpg'; ?>"/>
    <?php if($slide1_head || $slide1_desc) : ?>
      <div class="flex-caption">
        <h2><?php print $slide1_head; ?></h2><?php print $slide1_desc; ?>
        <a class="frmore" href="<?php print url($slide1_url); ?>"> <?php print t('CONTACT US'); ?> </a>
      </div>
    <?php endif; ?>
  </li>
  <li>
    <img src="<?php print base_path() . drupal_get_path('theme', 'nexus') . '/images/slide-image-2.jpg'; ?>"/>
    <?php if($slide2_head || $slide2_desc) : ?>
      <div class="flex-caption">
        <h2><?php print $slide2_head; ?></h2><?php print $slide2_desc; ?>
        <a class="frmore" href="<?php print url($slide2_url); ?>"> <?php print t('CONTACT US'); ?> </a>
      </div>
    <?php endif; ?>
  </li>
  <li>
    <img src="<?php print base_path() . drupal_get_path('theme', 'nexus') . '/images/slide-image-3.jpg'; ?>"/>
    <?php if($slide3_head || $slide3_desc) : ?>
      <div class="flex-caption">
        <h2><?php print $slide3_head; ?></h2><?php print $slide3_desc; ?>
        <a class="frmore" href="<?php print url($slide3_url); ?>"> <?php print t('CONTACT US'); ?> </a>
      </div>
    <?php endif; ?>
</li>
</ul><!-- /slides -->
<div class="doverlay"></div>
</div>
<?php endif; ?>
<?php endif; ?>

3 个答案:

答案 0 :(得分:1)

Smartling的Drupal连接器可能会有所帮助。这是一个显示连接器工作原理的video

在Smartling上运行的许多网站都会进行语言/国家/地区特定的图片替换,here解释了这一点。

希望这有帮助, NATALY

答案 1 :(得分:0)

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<SCRIPT>
function english(){
$(#image).attr('src','http://link.to.your/english/image.png')
}
function greek(){
$(#image).attr('src','http://link.to.your/greek/image.png')
}
</SCRIPT>
<IMG id="image" src="http://link.to.your/greek/image.png">
<A HREF="#" onclick="english">Change to English</A><BR>
<A HREF="#" onclick="greek">Change to Greek</A>

答案 2 :(得分:0)

最后我用php代码在page.tpl中修复了它。一个if / else在你的页面语言上设置你的图片路径。 此致,HashKey