0

我有非常基本的彩盒脚本:

<script src="data/scripts/jquery-1.10.2.min.js"></script>
<script src="/data/scripts/jquery.colorbox.js"></script>

<script>
$(document).ready(function(){  
    $(".InternalIMG").colorbox({rel:'InternalIMG', transition:"fade"})
});
</script>

一切都在静态文档中工作。

代码示例:

<a class="InternalIMG" href="/data/images/gallery/testing/UK.png" title="Absolutní schéma">
    <div class="image_left" style="background-image: url('data/images/gallery/testing/UK.png');"></div>
</a>

但是当我在 PHP 变量中使用它时,它根本不起作用:

      $gal_query = mysql_query("SELECT * FROM gomi_galerie_fotky WHERE section=" . $_GET['id'], $link);
      if (mysql_num_rows($gal_query) != 0) {
          while($gal_result=mysql_fetch_assoc($gal_query)) {
              if ($gallery_count % 3 == 0) {$gallery_rows .= '</tr><tr valign="middle" align="center">';};

              $gallery_rows .= '<td width="150px" height="150px" align="center" valign="middle" style="overflow: hidden;"><a class="InternalIMG" href="/data/images/gallery/testing/UK.png" title="Absolutní schéma"><div class="image_left" style="background-image: url(/data/images/gallery/thumbs/' . $gal_result['id'] . '.' . $gal_result['type'] . ');" title="' . $gal_result['body'] . '"></div></a></td>';
              $gallery_count++;  
          }

          $gallery = '<table align="center" border="0" width="150px" height="150px" style="table-layout:fixed"><tr valign="middle" align="center">' . $gallery_rows . '</tr></table>';

可能是 php 文件的问题(这些 php 变量在另一个 [included] php 文件中)。

感谢您的帮助。

4

1 回答 1

0

您应该关闭if. 添加}到 php 代码的末尾。

于 2013-08-11T13:26:31.400 回答