Hi All,

I've hooked on drupal for a one month now, and still have to tweak some skills around getting a proper results in views array.

I've got a view array output got with

print_r  $view

in my view template that looks like this:

view Object
(
    [db_table] => views_view
    [base_table] => node
    [args] => Array
        (
            [0] => My entry 1
        )

    [use_ajax] => 
    [result] => Array
        (
            [0] => stdClass Object
                (
                    [nid] => 5
                    [node_title] => Title of a test entry
                    [node_revisions_body] => 

Text text text text

                    [node_revisions_format] => 1
                    [node_vid] => 5
                    [term_data_name] => My first test term name
                    [term_data_vid] => 1
                    [term_data_tid] => 1
                    [vocabulary_name] => Vocabulary 1
                    [node_revisions_vid] => 5
                )

            [1]..
            ..
            [2]..
             ..
            [19] => stdClass Object
                (
                    [nid] => 176
                    [node_title] => View Reports
                    [node_revisions_body] => 

Text for testing, testing

                    [node_revisions_format] => 1
                    [node_vid] => 176
                    [term_data_name] => Test Name 2
                    [term_data_vid] => 1
                    [term_data_tid] => 1
                    [vocabulary_name] => Vocabulary 2
                    [node_revisions_vid] => 176
                )

        )

    [pager] => Array
        (
            [use_pager] => 
            [items_per_page] => 0
            [element] => 0
            [offset] => 0
            [current_page] => 0
        )

    [old_view] => Array
        (
            [0] => 
        )

    [vid] => 61
    [name] => Test name 3
    [description] => Test description
    [tag] => 
    [view_php] => 
    [is_cacheable] => 0
    [display] => Array
        (
            [default] => views_display Object
                (
                    [db_table] => views_display
                    [vid] => 61
                    [id] => default
                    [display_title] => Defaults
                    [display_plugin] => default
                    [position] => 1
                    [display_options] => Array
                        (
                            [fields] => Array
                                (
                                    [title] => Array
                                        (
                                            [label] => 
                                            [alter] => Array
                                                (
                                                    [alter_text] => 1
                                                    [text] => 
[title]

                                                    [make_link] => 0
                                                    [path] => 
                                                    [link_class] => 
                                                    [alt] => 
                                                    [prefix] => 

...
....

So, my question is, I can get the values from stdObject in a beginning like:

$view->result[0]->node_title will return Title of a test entry

I have problem accessing a views_display Object values inside an existing array like in [display] array that contains [default] => views_display Object:

print $view->display will return an array
but

$view->display->default[db_table]
wont return views_display as its value surely because I'm accessing it in a wrong way.

Any help is precious,

thanks in advance,

H

Comments

pbarnett’s picture

Shouldn't that be $view->display['default']->db_table ?

Pete.

xaviergnu’s picture

Yes, it should ;-) Tnx for that.

So based on that, deeper tree in array should be:

$view->display['default']['display_options']['fields']['title']['alter']->alter_text

with output 1 ?

I've tried that and didn't work?!

thanx in advance,

H.

pbarnett’s picture

Nope; display['default'] is an object; alter isn't an object, it's an array, so you want

$view->display['default']->display_options['fields']['title']['alter']['alter_text']

Pete.

xaviergnu’s picture

Thank you!

yakker’s picture

:)

andrenoronha’s picture

is it possible to acess the entries fields from the view footer?

pbarnett’s picture

Yes; what do you need to do with them?

Pete.

andrenoronha’s picture

ok thanks, nevermind...
i got what i wanted in here http://drupal.org/node/576962