1

I have a custom theme and I want to edit the HTML of a view. I am able to create template overrides but I get stuck, it seems like the editable part of a view does not go deep enough.

I have a view displaying all of a content type. The content type has the following fields a name, an image, a link, and a description. I want to edit all of these with custom elements, classes, ids, etc and change the order of them. However the deepest I can get into a view is the $row variable, which already has this content formatted.

I've ran a function called views_get_current_view(). When I run it's return through print_r I see the information I need deep inside of it, but when I try to grab that information Drupal runs out of memory, I do not want to allocate more memory and I don't think that's the best way to solve the problem.

Long story short - I'm trying to get the fields of each node in a view and customize their html, when I get that data from a view it seems to already be already coded.

Thanks

  • 1
    If you are using a View that displays content and not fields, eg, the whole node as it looks on a page or teaser, you can create a template called node--view--VIEWNAME.tpl.php (or even node--view--VIEWNAME--DISPLAYNAME.tpl.php) and then modify that however you want. If this isn't what's going on, and you have a View with fields, then you can reorder them in the Views UI and can definitely theme them independently as well. – Jimajamma Feb 13 '14 at 3:19
  • possible duplicate of Overriding views-view-fields.tpl.php – Mołot Feb 13 '14 at 10:15
0

If you are create any content type and select any content type name ex : your created a "news" is content type and many field as a 'id','name' etc.

after you have add a one php file name as a 'node--news.tpl.php'

and clear caches

this file always call a news content data

| improve this answer | |

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.