0

jCarouselを使用して、ブロックに表示されるスライドショーを作成しています。コンテンツタイプには画像アップロードフィールドがあり、それらの画像はカルーセルに表示されます。カルーセルでは、ノードごとに異なる画像が必要です。ビューでは、タイプ別にフィルターを定義しました。しかし、それはすべてのノードからすべての画像を取得します。どうすればこれを解決できますか?

4

2 に答える 2

0

template.phpコメントの詳細は次のとおりです。

page.tpl.phpに追加

<body class="<?php print $body_classes; ?>">

template.phpに、を追加します

function phptemplate_preprocess_page(&$vars, $hook) {
    // Classes for body element. Allows advanced theming based on context
    // (home page, node of certain type, etc.)
    $body_classes = array($vars['body_classes']);
    if (!$vars['is_front']) {

      // Add unique classes for each page and website section
      $path = drupal_get_path_alias($_GET['q']);
      list($section, ) = explode('/', $path, 2);
      $body_classes[] = phptemplate_id_safe('page-' . $path);
      $body_classes[] = phptemplate_id_safe('section-' . $section);
      if (arg(0) == 'node') {
        if (arg(1) == 'add') {
          if ($section == 'node') {
            array_pop($body_classes); // Remove 'section-node'
          }
          $body_classes[] = 'node-add'; // Add 'node-add'
        }
        elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) {
          if ($section == 'node') {
            array_pop($body_classes); // Remove 'section-node'
          }
          $body_classes[] = 'node-' . arg(2); // Add 'node-edit' or 'node-delete'
        }
      }
    }
    $vars['body_classes'] = implode(' ', $body_classes); // Concatenate with spaces
  }

  function phptemplate_id_safe($string) {
    if (is_numeric($string{0})) {
      // If the first character is numeric, add 'n' in front
      $string = 'n'. $string;
    }
    return strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string));
  }
于 2011-02-03T17:10:07.523 に答える
0

特定のページに必要な画像は、そのページからアップロードされていますか?

その場合は、Node:NID引数を使用できます。

「引数が存在しない場合に実行するアクション:」の下。

「デフォルトの引数を提供する」にチェックを入れます

次に「URLからのノードID」

于 2011-02-03T16:14:19.750 に答える