I am working on using Views module to create my first custom page. I have run into some problems. I have the view set up, and having it going to the right URL. In the view, there are 10 fields I want to display, all properties in a profile. I have them unformatted, as I want to be able to style them how I would like. I am looking to just access the profile fields for all users, and spit them out.
Here is where it gets wierd. It is printing out the first user content 9 times. I have no idea why, but it is. There are two users with profiles on this setup, and it is only showing the first one. I also would like to create some kind of preprocess and have variables containing the content. I typically would print_r($content) and it shows me all of the html, but that is not the case when using views. I am going to try to figure that one out.
Comments
_
Are you using a node view or a user view?
Node View
I am using a node view. Really, I am open to suggestions on how to layout snippets from profiles of all users. I am willing to try anything. I figured this is a simple enough task to do so that I can learn how to use views a bit better. I am not really looking for a module to do this, because I think that views is capable. Any suggestions?
_
That's the reason the user info is printed out multiple times-- once for each node the user has authored. Node views list nodes, user views list users. Start out with a user view and you won't have this problem.
Thanks
So do I have to redo the view entirely? I do not see any option to change the type. Not a big deal, I'm just curious for the future.
_
yep-- afaik that's the one thing you have to start over to change.
So now it looks like it is
So now it looks like it is working as expected, as long as I do not have any custom .tpl files being rendered. For example, I named the view 'people' and go to my url '?q=people', and I see what I would expect. Now, I want to customize the output of all of the fields. So, I add a suggested file, views-view--people.tpl.php, for a Display Output. In there, I simply add a var_dump('Hello');. and rescan the template files. It is being detected by the Views module, and when I hit the URL, I can see the var_dump() just fine.
Now, I am trying to print out the contents of the fields in the view. I have tried the following:
print $content
print_r($content)
var_dump($content)
devel(content)
I also tried hijacking the user_profile preprocessor:
function phptemplate_preprocess_user_profile(&$vars) {
var_dump($vars);
}
I get nothing. I found this from the user module, however I am not sure this is what I am looking for. I really want to be able to manipulate the fields that are sent into the views-view--people.tpl.php file with my own custom tags. Any idea on this one? I got a lot from some podcasts on Views Theming, but I am missing something... Any ideas?
_
as far as know, there is no $content for a view. To see what variables are available for the template you are using click on the "Theme: information" link in the view's basic settings box, then the link for the template you are using-- it will give you the info you need to theme the view. For some good info on views theming see http://drupal.org/node/352970.