Views 2 table smink

mester képe

Views 2 tábla listázási módot szeretném sminkelni.

Az egyes mezőket hogy lehet elérni? $rows?

Segítség:

// $Id: views-view-table.tpl.php,v 1.6 2008/06/25 22:05:11 merlinofchaos Exp $
/**
 * @file views-view-table.tpl.php
 * Template to display a view as a table.
 *
 * - $title : The title of this group of rows.  May be empty.
 * - $header: An array of header labels keyed by field id.
 * - $fields: An array of CSS IDs to use for each field id.
 * - $class: A class or classes to apply to the table, based on settings.
 * - $rows: An array of row items. Each row is an array of content
 *   keyed by field ID.
 * @ingroup views_templates
 */

illetve egy field template fájlából (views-view-field.tpl.php) el lehet érni másik field tartalmát?

Segítség:

// $Id: views-view-field.tpl.php,v 1.1 2008/05/16 22:22:32 merlinofchaos Exp $
 /**
  * This template is used to print a single field in a view. It is not
  * actually used in default Views, as this is registered as a theme
  * function which has better performance. For single overrides, the
  * template is perfectly okay.
  *
  * Variables available:
  * - $view: The view object
  * - $field: The field handler object that can process the input
  * - $row: The raw SQL result that can be used
  * - $output: The processed output that will normally be used.
  *
  * When fetching output from the $row, this construct should be used:
  * $data = $row->{$field->field_alias}
  *
  * The above will guarantee that you'll always get the correct data,
  * regardless of any changes in the aliasing that might happen if
  * the view is modified.
  */

Köszi.
 print $output;

Melyik modulhoz, modulokhoz kapcsolódik a téma?: 
Drupal verzió: 
aries képe

mester képe

Jó lennének példák is, de itt pontosan hol lehet megtalálni a példákat ???

0
0
Pasqualle képe

1. pl nid mezo erteke: $fields['nid']->content
2. ugy tudom nem lehet elerni. a field.tpl.php csak az aktualis mezo informaciokat tartalmazza

0
0
mester képe

$fields['nid']->content ezzel nem működik :S

0
0
Pasqualle képe

$fields['nid']->content csak olyan view-ban mukodik ahol van 'nid' mezo a view-ban (tehat a nid mezot a views feluleten beleraktad a fields listaba)..

probalkozz olyan mezokkel amik szerepelnek a view-ban..

0
0
Pasqualle képe

mester képe

$fields['nid']->content csak olyan view-ban mukodik ahol van 'nid' mezo a view-ban

Itt akkor se jó még ha beteszem a mezők közé a NID-et :S
Videót is megnéztem, az egyértelmű, de itt jobban el vannak rejtve a változók.

Elérhető változók:
* - $title : The title of this group of rows. May be empty.
* - $header: An array of header labels keyed by field id.
* - $fields: An array of CSS IDs to use for each field id.
* - $class: A class or classes to apply to the table, based on settings.
* - $rows: An array of row items. Each row is an array of content
* keyed by field ID.

Konkrétan arról lenne szó, hogy az egyik cellába két mező értékét szertném belerakni.

0
0
Pasqualle képe

probald ki ezt a templatet, talan ez megmagyarazza, hogy hogyan hivatkozz a mezokre:
views-view-table.tpl.php

<table class="<?php print $class; ?>">
  <?php if (!empty($title)) : ?>
    <caption><?php print $title; ?></caption>
  <?php endif; ?>
  <thead>
    <tr>
      <?php foreach ($header as $field => $label): ?>
        <th class="views-field views-field-<?php print $fields[$field]; ?>">
          <?php print $label; ?>
        </th>
      <?php endforeach; ?>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($rows as $count => $row): ?>
      <tr class="<?php print ($count % 2 == 0) ? 'even' : 'odd';?>">
        <?php foreach ($row as $field => $content): ?>
          <td class="views-field views-field-<?php print $fields[$field]; ?>">
            $row['<?php print $field; ?>'] = <?php print $content; ?>
          </td>
        <?php endforeach; ?>
      </tr>
    <?php endforeach; ?>
  </tbody>
</table>
0
0
Pasqualle képe

igazad volt, a tablazatos nezetben nem fields kell hanem row

tehat $row['nid'] ben van benne a nid erteke

0
0
mester képe

$row['id'] !!! Ezt kerestem, köszi, működik.

0
0