Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.5
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Feb 2013 at 21:10 UTC
Updated:
8 Mar 2013 at 10:00 UTC
It used to be so easy.
<?php print $fields['title']->content; ?>
...printed the title in a simple view template for rows. In something like views-view-fields--test.tpl.php.
In Drupal 7 and Views 3.5, this produces errors:
Undefined index: title in include()....etc.
Trying to get property of non-object in include()...etc.
...please, I'm not really a developer, what do I use instead of:
<?php print $fields['title']->content; ?>
?
Comments
Comment #1
merlinofchaos commentedNothing in how that template has changed, so there is something missing here.
First, are you sure you're using the right template? "Something like" views-view-fields--test.tpl.php may not actually be a variation of views-view-fields.tpl.php so we need to make sure.
Second, are you sure you have the correct field ID? Does the 'title' field actually exist as a field?
It might help to do this:
That will tell you what fields you actually have access to in the template. Perhaps that is enough information to help you proceed?
I'm going to mark this fixed, as i haven't any more advice to give, but if you need additional help, there might be more you can provide after you've answered the above questions. If so, mark this issue active again.
Comment #2
andrew smith commentedThank you for the brilliant module and responding with the useful php.
My mistake was setting Title and other fields to 'Exclude from display' (bringing them into a Global Text field).
'Exclude from display' seems to exclude it from template as well, which I mention here just in case someone else makes the same mistake.
Comment #3.0
(not verified) commentedtypo