简体   繁体   中英

Drupal 7 Fields used for Variables

I need to use the fields in a content page to act as variables in a script running on the same page. I doing this so the client can just update the field rather then search through the script which would be a disaster. How would I do this?

Thank you.

Get the node ID for the piece of content you're interested in, then use node_load($nid) to get the node object. All of the fields will be represented there, though you may have to examine the object to figure out exactly what the data structure is.

You could just var_dump() the node object to the page as a simple, cheap way to figure out the name of the property you want and which indices, if any, to specify in your script. (once you figure it out, it won't change.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM