3 つの異なるコンテンツ タイプからタイトルを取得するビューがあります。これらのコンテンツ タイプの 1 つには、外部 Web サイトにリンクするタイトルがあり、他の 2 つのタイプには、Drupal サイト内のノードにリンクするタイトルがあります。タイトルのコンテンツ タイプに応じてリンクを異なる方法で処理するように [タイトル] フィールドを設定する方法はありますか?
以下のVladに感謝します!! :)
views-view-fields--news--block.tpl.php
これは、テンプレートで使用している作業コードです..
<?php if ($fields['type']->content == 'Event'): ?>
<a href="<?php print $fields['path']->content; ?>"><?php print $fields['title']->content; ?></a>
<?php endif; ?>
<?php if ($fields['type']->content == 'PATF News'): ?>
<a href="<?php print $fields['path']->content; ?>"><?php print $fields['title']->content; ?></a>
<?php endif; ?>
<?php if ($fields['type']->content == 'News Link'): ?>
//This link goes to _blank
<a href="<?php print $fields['field_link']->content; ?>" target="_blank"><?php print $fields['title']->content; ?></a>
<?php endif; ?>