V
V
Vadim Timoshenko2016-03-04 20:25:20
PHP
Vadim Timoshenko, 2016-03-04 20:25:20

How to split $row in drupal views into components?

I'm working on themeing the template. I embed a block that generates views in the finished layout.
Now there is this code:

<?php foreach ($rows as $id => $row): ?>
        <div class="four columns">
            <div class="item">
                <?php print $row; ?>
            </div>
        </div>
        <?php endforeach; ?>

But print $row; displays both the title and the text of the node at once. And I need to put the title in my html tags, the text in my own. PHP masters, tell me how to be? How to extract separate parts from $row? Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikit Khaner, 2016-03-08
@PbI6A_KuT

This is the template for "Style output" in views - $row is already generated in html there, you can use str_replace or regexps here.
I recommend going down the template, for example, Row style output or templates by fields (if Views shows fields, if an entity, then change the entity itself in the template).

A
Andrey, 2016-03-04
@VladimirAndreev

var_dump($row); die; what outputs?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question