Closed (fixed)
Project:
Views (for Drupal 7)
Version:
5.x-1.6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Feb 2008 at 04:15 UTC
Updated:
7 Apr 2009 at 20:30 UTC
Hey,
I'm using panels 2, combined with (core) profile, to create a profile page for users; I'm then using views for field data ("Who I am", "Interests", etc.). The problem: if the user hasn't filled in corresponding data into whatever field then the corresponding label still shows. What method (.tpl.php?) could I use to make field labels disappear if the corresponding field data hasn't been inputted by the user?
Comments
Comment #1
pribeh commentedOk, so I've been reading the view-theme literature but still am at a loss as to what php I'd use to make this happen. I'm not a php programmer yet and have only successfully implemented a profile.tpl.php so far - which I'm no longer using since implementing profile via panels 2.
This isn't an issue with panels 2, is it?
Comment #2
inforeto commentedThere's several ways to modify the output of the views.
One way is by theming the view. Search for "theme views" for php examples.
Another way is that instead of inserting the view you use the views API to get a php array with the results and work with it.
It'd be easier if the view shows a single user profile, as it will be only one result to check. (one field per label)
Comment #3
pribeh commentedThanks for your help. Alas, I'm not a php programmer. So I'll have to wait until I can get someone to help me program this.
Comment #4
dries arnoldssubscribing
Comment #5
catchYou don't need to know a lot of php to do this, it ought to be pretty much adding an if statement. Take a look at the handbook page to get started: http://drupal.org/node/109604
Comment #6
domesticat commentedPerforming a mass closing of all issues over 180 days old. Please reopen if needed.