Active
Project:
Views Custom Field
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Aug 2009 at 17:46 UTC
Updated:
28 Oct 2009 at 16:21 UTC
Hello,
I was wondering if someone could help with the following request.
I would like two CCK fields to display as one field in Views.
For example, in the profile registration I fill out 'First Name' field and 'Last Name' field.
In the Views, I would like one field that show "First Name(space)Last Name" using custom views field.
I would truly appreciate any help on this.
Thank you very much in advance.
Comments
Comment #1
Bilmar commentedHello again,
I changed the issue settings to better fit my request.
Is there anyone that can help me with the php coding for the above requirement.
Thank you!
Comment #2
casey commented1. Add the two fields you want to combine to your view.
2. Exclude them from display (optional).
3. Add a "Custom Field: PHP Code".
4. Find out what variable names your two fields have (use print_r($data) in the PHP Code field).
5. Use something like this in your PHP Code field:
Comment #3
Bilmar commentedThank you very much for your help! I have been studying drupal and php very hard to better understand how to make a website.
Would you happen to know how I could have it "(First Name) [space] (Inital of Last Name)" in the custom field?
Comment #4
casey commentedor
Comment #5
bmblack commentedI'm sorry, I dont understand these steps. Could somebody explain them in more detail please? I'd REALLY appreciate it.
1. I added two new fields (went into my content types -> user profile -> new field). The two fields I added were: field_firstname and field_lastname.
2. By default they don't display anywhere, so that's good.
3. I'm not sure how to add a "Custom Field: PHP Code".
4. Could somebody explain how to do this?
5. I think if I can get help with steps 3-4, this code would work.
I really appreciate any help!!
Thanks in advance.