Solved

Drupal 6: Unable to retrieve field's value in view

Posted on 2011-09-21
7
332 Views
Last Modified: 2012-05-12
I'm new to Drupal and I just inherited from a developer a content profile form with several fields (used as registration form). I added a few fields but I can't retrieve their values in a views, while the older ones show up correctly. The following for example prints nothing:

<?php print $fields['field_membership_type'] ?>

Open in new window


In the views, I even set the above filed to be set to "xxxx" if empty, but still nothing gets through.

There are no typos and permissions look right (identical to the old fields), so I'm out of ideas...

Thanks
0
Comment
Question by:jiiins2
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:oliverpolden
ID: 36572458
First of all make sure you are editing the correct file and that the output isn't being cached.
Edit the file to put '#' or something identifiable outside the <?php ?> tags.  Clear your cache and check you can see your change. If you can't see your change, then you're probably editing the wrong file. (where is the file you are editing and what is it called?)
That may solve your problem (by clearing the cache).
Next, you will need to edit the view to add the extra fields you want.
0
 

Author Comment

by:jiiins2
ID: 36572554
Unfortunately i already tried all of the above. I get only my two ## as print out...
0
 
LVL 9

Accepted Solution

by:
oliverpolden earned 500 total points
ID: 36572576
Are you able to give me a log in to have a look?  You may also want to do print_r($fields); or dpm($fields); if you have the devel module installed.

You probably need to do something like: $fields[0]['field_membership_type'];
Note the [0]
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:jiiins2
ID: 36572636
I did the print_r and it shows the new fields as empty. The old fields are printing out just fine without the [0]. How can I pass you the login safely?
0
 
LVL 9

Expert Comment

by:oliverpolden
ID: 36572641
oliver@e3m.co.uk
0
 

Author Comment

by:jiiins2
ID: 36572665
on its way
0
 

Author Comment

by:jiiins2
ID: 36577581
Got it:

<?php print $fields['field_membership_type_value']->content ; ?>

Open in new window

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Read about how to choose the best possible content marketing agency to suit your needs. Content marketing has become an integral part of running a successful tech business, so it is wise to be informed.
This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now