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

2
  • 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
    Commented Feb 13, 2014 at 3:19
  • possible duplicate of Overriding views-view-fields.tpl.php
    – Mołot
    Commented Feb 13, 2014 at 10:15

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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