Negatiff
@Negatiff
Делаю сайты

Как вывести $view->result?

Необходимо программно вывести в шаблоне модуля Calendar одно поле из views.
print_r($view->result) отдает следующее:
Array
(
    [0] => stdClass Object
        (
            [field_data_event_calendar_date_delta] => 0
            [date_id_event_calendar_date] => 9
            [date_delta_event_calendar_date] => 0
            [node_title] => 2015-07-28 00:00:00
            [nid] => 9
            [field_data_event_calendar_date_event_calendar_date_value] => 2015-07-28 00:00:00
            [field_data_event_calendar_date_node_entity_type] => node
            [_field_data] => Array
                (
                    [nid] => Array
                        (
                            [entity_type] => node
                            [entity] => stdClass Object
                                (
                                    [vid] => 9
                                    [uid] => 1
                                    [title] => 2015-07-28 00:00:00
                                    [log] => 
                                    [status] => 1
                                    [comment] => 1
                                    [promote] => 0
                                    [sticky] => 0
                                    [nid] => 9
                                    [type] => event_calendar
                                    [language] => ru
                                    [created] => 1437909391
                                    [changed] => 1437909391
                                    [tnid] => 0
                                    [translate] => 0
                                    [revision_timestamp] => 1437909391
                                    [revision_uid] => 1
                                    [event_calendar_status] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [tid] => 7
                                                        )

                                                )

                                        )

                                    [event_calendar_date] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [value] => 2015-07-28 00:00:00
                                                            [timezone] => Europe/Moscow
                                                            [timezone_db] => Europe/Moscow
                                                            [date_type] => datetime
                                                        )

                                                )

                                        )

                                    [rdf_mapping] => Array
                                        (
                                            [rdftype] => Array
                                                (
                                                    [0] => sioc:Item
                                                    [1] => foaf:Document
                                                )

                                            [title] => Array
                                                (
                                                    [predicates] => Array
                                                        (
                                                            [0] => dc:title
                                                        )

                                                )

                                            [created] => Array
                                                (
                                                    [predicates] => Array
                                                        (
                                                            [0] => dc:date
                                                            [1] => dc:created
                                                        )

                                                    [datatype] => xsd:dateTime
                                                    [callback] => date_iso8601
                                                )

                                            [changed] => Array
                                                (
                                                    [predicates] => Array
                                                        (
                                                            [0] => dc:modified
                                                        )

                                                    [datatype] => xsd:dateTime
                                                    [callback] => date_iso8601
                                                )

                                            [body] => Array
                                                (
                                                    [predicates] => Array
                                                        (
                                                            [0] => content:encoded
                                                        )

                                                )

                                            [uid] => Array
                                                (
                                                    [predicates] => Array
                                                        (
                                                            [0] => sioc:has_creator
                                                        )

                                                    [type] => rel
                                                )

                                            [name] => Array
                                                (
                                                    [predicates] => Array
                                                        (
                                                            [0] => foaf:name
                                                        )

                                                )

                                            [comment_count] => Array
                                                (
                                                    [predicates] => Array
                                                        (
                                                            [0] => sioc:num_replies
                                                        )

                                                    [datatype] => xsd:integer
                                                )

                                            [last_activity] => Array
                                                (
                                                    [predicates] => Array
                                                        (
                                                            [0] => sioc:last_activity_date
                                                        )

                                                    [datatype] => xsd:dateTime
                                                    [callback] => date_iso8601
                                                )

                                        )

                                    [cid] => 0
                                    [last_comment_timestamp] => 1437909391
                                    [last_comment_name] => 
                                    [last_comment_uid] => 1
                                    [comment_count] => 0
                                    [name] => admin
                                    [picture] => 0
                                    [data] => b:0;
                                )

                        )

                )

            [field_event_calendar_date] => Array
                (
                    [0] => Array
                        (
                            [rendered] => Array
                                (
                                    [#markup] =&gt; <span class="date-display-single" property="dc:date" datatype="xsd:dateTime" content="2015-07-28T00:00:00+03:00">вторник, июля 28, 2015</span>
                                    [#access] =&gt; 1
                                )

                            [raw] =&gt; Array
                                (
                                    [value] =&gt; 2015-07-28 00:00:00
                                    [timezone] =&gt; Europe/Moscow
                                    [timezone_db] =&gt; Europe/Moscow
                                    [date_type] =&gt; datetime
                                )

                        )

                )

        )

)


Как получить event_calendar_status?

Пробовал так:
<?php print $view->result[0][_field_data][nid][entity][event_calendar_status][und][0][tid];   ?>


Получаю:
Cannot use object of type stdClass as array in
  • Вопрос задан
  • 179 просмотров
Решения вопроса 1
afi13
@afi13
Вы обращаетесь к свойствам объектов как к массивам.
$view->result[0]->_field_data['nid']['entity']->event_calendar_status[LANGUAGE_NONE][0]['tid'];
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы