2

I'm overriding drupal /blog path with a views. Created a new view page display and set path to blog. Created views-view-unformatted--blog-page.tpl and trying to output view fields this way:

<?php 
print $fields['title']->content;
print $fields['body']->content;
?>

But all what i get is nothing, tried to output <?php print 'Hello, world!'; ?> == it outputs Hello,world. But i can't print Views fields...

PS in another view display - printing fields this way works perfectly. Blank fields affects only blog page view display

2

The template you have overwritten looks like this (in Drupal 6):

<?php if (!empty($title)): ?>
  <h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
  <div class="<?php print $classes[$id]; ?>">
    <?php print $row; ?>
  </div>
<?php endforeach; ?>

As you can see, it's purely used to print out the rows in the view; you should instead use one of the other templates available, if you want to alter the fields. Take a look at the theming information button in the UI that will give you a complete list with previews.

  • Oh, god. You're right, thanks! Worked all day and now im not attentive :( – Alexander Kim May 30 '11 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.