Hello,

I'v been searching the forums and found some routes to go on, but haven't gotten much love from my programming.

I've created a view which shows a couple of fields of a specific node in a block. Now I want to theme some of these fields within two divs to style those divs within one block.

I created an override template which works fine: block--views--information-block.tpl.php

I've been trying to print the fields like this:

<div class="content">
  <?php  hide($content['field_club']); ?>
    <?php print($content); ?>
    TEST
<?php
print render($content['field_club']); 
?>
  </div>

field_club is the machine name of the field. I'm thinking I'm not putting in the right name, but have tried various names including views_field_field_club and more. All I get is:

Only variables can be passed by reference...

Any thoughts on how I can get this to work?

Comments

nevets’s picture

It would make more sense to theme the view overriding one or more of its templates, use the "rewrite this field" feature of views or use semantic views

wemmies’s picture

I have been looking into the rewrite, but couldn't figure out how to put 3 fields into one div within the view block.

nevets’s picture

Lets say your three fields are A, B and C. You want them ordered so C is last.

Edit/configure each field. A and B so they have "exclude from display" set

C so "Rewrite this field is set" and in the text box place your div and the replacement patterns for the 3 fields.

wemmies’s picture

Thanks, that put me where I needed to be. I think I now can get what I want. Will try tonight as I'm of to work now.

===UPDATE===

I got what i wanted. Thanks for the help, got things done in a much easier way this way. I guess I need to dive into Views a bit more and start to play around there.