Temp.tpl.php (Temp는 뷰 이름 임) 뷰를 생성하여 날짜에 따라 클래스에 삽입합니다. 다음은 생성 된 날짜를 Time Ago로 변경하고 stripos로 Week 또는 Day를 검색 한 예제입니다. php date math 또는 다른 메소드를 사용하여 클래스를 삽입 할 수 있습니다. 이것은 매우 기본적이고 조정이 필요합니다.
<?php
// $Id: views-view-table.tpl.php,v 1.8 2009/01/28 00:43:43 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.
* - $row_classes: An array of classes to apply to each row, indexed by row
* number. This matches the index in $rows.
* - $rows: An array of row items. Each row is an array of content.
* $rows are keyed by row number, fields within rows are keyed by field ID.
* @ingroup views_templates
*/
?>
<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 implode(' ', $row_classes[$count]); ?> <?php
if(stripos($row["created"], "Week")) {
print "week-class ";
}
if(stripos($row["created"], "Day")) {
print "day-class ";
}?>
">
<?php foreach ($row as $field => $content): ?>
<td class="views-field views-field-<?php print $fields[$field]; ?>">
<?php print $content; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
예를 들어, 어떻게 테이블을 생성합니까? 템플릿 (tpl.php) 파일을 사용하고 있습니까? 또는 다른 모듈을 사용합니까? – dusan
보기 모듈 - SQL 작성에 신경 쓰지는 않지만 뷰의 유연성을 좋아합니다. 인수, 블록, 쉬운 아약스 등. – tpow