I am completely lost at how I would get the value of a CCK field. What I have done is created a text field for the content type Page. I then populated that field with information (a path to an image). Then, in my theme, I want to pull that path, so I can use the image on the current page that is being displayed. How do I go about doing that.

Thanks,
Shane

Comments

shanefjordan’s picture

Status: Active » Closed (fixed)

I figured out how to get the the information from the field. To get the value that was entered into the field, I use

$node->field_FIELDNAME[0]['value']

Change FIELDNAME to the name of your field. This will get the value for a single field, if you wanted to get it for a multiple, put that code in a for loop with the 0 changed to the incremental number.

- Shane