简体   繁体   中英

how to get values of custom fields to show on drupal template?

I have a file in my Drupal theme: views-view-fields--homepage-blocks.tpl.php

This is intended to output blocks in the home page. At the moment I am using the following code for testing purposes.

<h3><?php echo $fields['title']->content; ?></h3>
<?php
echo $fields['field_url']->content;
echo $fields['field_link_title']->content;
echo $fields['field_homepage_block_image']->content;
echo $fields['body']->content;

The title, body and field_homepage_block_image fields are displaying correctly but the field_url and field_link_title fields are not showing at all. These are custom fields that I have just set up - they are of the "text" type. I have cleared the cache and this doesn't seem to make any difference.

The site is online here http://access.kdcloud.co.uk/~dodsgpne/

The blocks I am trying to make work are the 4 grey ones in the middle of the page.

Any help much appreciated!

Have you already tried using the dsm() function? This may help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM