Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

I have figured out I need to override two templates:

  1. views-view-fields.tpl.php
  2. views-view-unformatted.tpl.php

Basically my node has an "align" property which I need to access in both templates to properly generate the expected markup.

<?php echo '<pre>'; print_r(get_defined_vars()); exit; ?> 

Using this I can see I have a monster of a structure at my disposal but the I am nervous about traversing such a structure as the slightest change to it's arrangment means my template(s) would break!!!

Ideally I would like to implement a preprocessor such as:

How can I add variables from a preprocessor function to be used in an unformatted view template?How can I add variables from a preprocessor function to be used in an unformatted view template?

Basically add the "align" value from the node to a simple variable which I can then access and check inside both templates listed above...

Suggestions???

I have figured out I need to override two templates:

  1. views-view-fields.tpl.php
  2. views-view-unformatted.tpl.php

Basically my node has an "align" property which I need to access in both templates to properly generate the expected markup.

<?php echo '<pre>'; print_r(get_defined_vars()); exit; ?> 

Using this I can see I have a monster of a structure at my disposal but the I am nervous about traversing such a structure as the slightest change to it's arrangment means my template(s) would break!!!

Ideally I would like to implement a preprocessor such as:

How can I add variables from a preprocessor function to be used in an unformatted view template?

Basically add the "align" value from the node to a simple variable which I can then access and check inside both templates listed above...

Suggestions???

I have figured out I need to override two templates:

  1. views-view-fields.tpl.php
  2. views-view-unformatted.tpl.php

Basically my node has an "align" property which I need to access in both templates to properly generate the expected markup.

<?php echo '<pre>'; print_r(get_defined_vars()); exit; ?> 

Using this I can see I have a monster of a structure at my disposal but the I am nervous about traversing such a structure as the slightest change to it's arrangment means my template(s) would break!!!

Ideally I would like to implement a preprocessor such as:

How can I add variables from a preprocessor function to be used in an unformatted view template?

Basically add the "align" value from the node to a simple variable which I can then access and check inside both templates listed above...

Suggestions???

Source Link
Alex.Barylski
  • 859
  • 2
  • 13
  • 27

Retrieve node information in VIEWS template(s)

I have figured out I need to override two templates:

  1. views-view-fields.tpl.php
  2. views-view-unformatted.tpl.php

Basically my node has an "align" property which I need to access in both templates to properly generate the expected markup.

<?php echo '<pre>'; print_r(get_defined_vars()); exit; ?> 

Using this I can see I have a monster of a structure at my disposal but the I am nervous about traversing such a structure as the slightest change to it's arrangment means my template(s) would break!!!

Ideally I would like to implement a preprocessor such as:

How can I add variables from a preprocessor function to be used in an unformatted view template?

Basically add the "align" value from the node to a simple variable which I can then access and check inside both templates listed above...

Suggestions???