开发者

Building a slideshow with the jCarousel module

I'm using jCarousel to build a slideshow that displays in a block. The content type has image upload fields and those images are going to display in the carousel. I want that every node ha开发者_StackOverflow中文版s a different images in the carousel. In Views I defined filters by Type. But that takes all the images from every node. How can I solve this?


Are the images you want on a specific page uploaded via that page?

If so, you can use the Node:NID argument.

Under "Action to take if argument is not present:"

check "Provide default argument"

then "Node ID from URL"


Here's more info about the template.php comment:

In page.tpl.php add

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

in template.php, add

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));
  }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜