0
<?php

// no direct access
defined('_JEXEC') or die('Restricted access');

if (!is_array($this->row->images)) {
    return ;
}

$mainImage = array_shift($this->row->images);



$previousLabel = JText::_('Previous');
$nextLabel     = JText::_('Next');

$script=<<<EOB
    var previousLabel = '$previousLabel';
    var nextLabel = '$nextLabel';
EOB;


$this->document->addScriptDeclaration($script)
               ->addScript(JURI::root(true).'/media/com_jea/js/jea-squeezebox.js');

JHTML::_('behavior.modal', 'a.jea_modal', array('onOpen' => '\onOpenSqueezebox'));
?>

<div class="clr" ></div>

<div id="jea-gallery-preview" >
<a class="jea_modal" href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           id="jea-preview-img"
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>" /></a>
</div>

<?php if( !empty($this->row->images)): ?>
<div id="jea-gallery-scroll" >
    <?php foreach($this->row->images as $image) : ?>
      <a class="jea_modal" href="<?php echo $image->URL?>" >
      <img src="<?php echo $image->minURL ?>" 
           alt="<?php echo $image->title ?>" 
           title="<?php echo $image->description  ?>" /></a><br />
    <?php endforeach ?>
</div>
<?php endif ?>

这是我在 JEA 组件中的默认 joomla 属性图像挤压箱库代码。

我用 jquery 更改了幻灯片预览,我的新代码是这样的

<?php

// no direct access
defined('_JEXEC') or die('Restricted access');
$document = &JFactory::getDocument();
$document->addScript("components/com_jea/views/property/tmpl/js/jquery-1.8.0.min.js");
$document->addScript("components/com_jea/views/property/tmpl/lib/jquery.ad-gallery.js");
$document->addScript("components/com_jea/views/property/tmpl/lib/inside.js");
$document->addStyleSheet("components/com_jea/views/property/tmpl/lib/jquery.ad-gallery.css");
$document->addStyleSheet("components/com_jea/views/property/tmpl/lib/inside.css");  
if (!is_array($this->row->images)) {
    return ;
}

$mainImage = array_shift($this->row->images);



$previousLabel = JText::_('Previous');
$nextLabel     = JText::_('Next');

$script=<<<EOB
    var previousLabel = '$previousLabel';
    var nextLabel = '$nextLabel';
EOB;


$this->document->addScriptDeclaration($script)
               ->addScript(JURI::root(true).'/media/com_jea/js/jea-squeezebox.js');

JHTML::_('behavior.modal', 'a.jea_modal', array('onOpen' => '\onOpenSqueezebox'));
?>


<div class="clr" ></div>




  <body>
  <div id="container">


    <div id="gallery" class="ad-gallery">
      <div class="ad-image-wrapper">
      </div>
      <div class="ad-controls">
      </div>
      <div class="ad-nav">
        <div class="ad-thumbs">
          <ul class="ad-thumb-list">

            <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image0" /></a>

            </li>
            <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image1" /></a>

            </li>
              <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image2" /></a>

            </li>
            <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image3" /></a>

            </li>
               <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image4" /></a>

            </li>
            <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image5" /></a>

            </li>
               <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image6" /></a>

            </li>
            <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image7" /></a>

            </li>
               <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image8" /></a>

            </li>
            <li>
              <a href="<?php echo $mainImage->URL ?>" >
      <img src="<?php echo $mainImage->mediumURL ?>" 
           width="90px"; height="50px";
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>"

   class="image9" /></a>

            </li>
          </ul>
        </div>
      </div>
    </div>

但问题是这个

我将如何使用 Joomla 代码显示其他图像?

4

3 回答 3

1

你为什么不保留格式而只是添加了一个增量变量?

<ul class="ad-thumb-list">

    <li>
        <a class="jea_modal" href="<?php echo $mainImage->URL ?>" >
            <img src="<?php echo $mainImage->mediumURL ?>"  alt="<?php echo $mainImage->title ?>" title="<?php echo $mainImage->description ?>" class="image0" />
        </a>
    </li>

    <?php if( !empty($this->row->images)): ?>
        <li>
            <?php $num = 1; foreach($this->row->images as $image) : ?>
                <a class="jea_modal" href="<?php echo $image->URL ?>" >
                    <img src="<?php echo $image->mediumURL ?>" alt="<?php echo $image->title ?>" title="<?php echo $image->description ?>" class="image<?php echo $num++; ?>" />
                </a>
            <?php endforeach; ?>
        </li>
    <?php endif; ?>
</ul>
于 2012-08-18T08:14:56.537 回答
0

我认为如果您更改所有代码并保留 JEA 组件的原始代码会更好。然后,安装 YooEffects(您可以从 yootheme 页面免费下载该组件)。

之后,转到负责创建画廊的 php 文件(在我的例子中:/components/com_jea/views/property/tmpl/default_squeezebox.php),只需更改以下代码:

<a class="jea_modal" href="<?php echo $mainImage->URL ?>" >
  <img src="<?php echo $mainImage->mediumURL ?>" 
       id="jea-preview-img"
       alt="<?php echo $mainImage->title ?>" 
       title="<?php echo $mainImage->description ?>" /></a>

对于这个:

<a data-lightbox="group:apartamento" href="<?php echo $mainImage->URL ?>" >
<!-- <a class="jea_modal" href="<?php echo $mainImage->URL ?>" >-->
      <img src="<?php echo $mainImage->mediumURL ?>" 
           id="jea-preview-img"
           alt="<?php echo $mainImage->title ?>" 
           title="<?php echo $mainImage->description ?>" /></a>

然后,对项目的其余图像执行相同操作。最后,你会得到这样的东西:

<div id="jea-gallery-preview" >

<a data-lightbox="group:apartamento" href="<?php echo $mainImage->URL ?>" >

    <!-- <a class="jea_modal" href="<?php echo $mainImage->URL ?>" >-->
          <img src="<?php echo $mainImage->mediumURL ?>" 
               id="jea-preview-img"
               alt="<?php echo $mainImage->title ?>" 
               title="<?php echo $mainImage->description ?>" /></a>
    </div>

    <?php if( !empty($this->row->images)): ?>
    <div id="jea-gallery-scroll" >
        <?php foreach($this->row->images as $image) : ?>
          <a data-lightbox="group:apartamento" href="<?php echo $image->URL?>" >
      <!--<a class="jea_modal" href="<?php echo $image->URL?>" >-->
      <img src="<?php echo $image->minURL ?>" 
           alt="<?php echo $image->title ?>" 
           title="<?php echo $image->description  ?>" /></a><br />
    <?php endforeach ?>
</div>
于 2012-10-02T10:28:45.313 回答
0

此代码不再起作用。那是因为 Yooeffects 不再适用于 Joomla 3x 。JEA 的代码也发生了变化。

于 2016-08-18T11:36:07.223 回答