Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6714235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:28:18+00:00 2026-05-26T08:28:18+00:00

I have a node reference field which I can output using echo render( $content[‘field_link’]

  • 0

I have a node reference field which I can output using echo render( $content['field_link'] );

This is fine for one situation in the node but I also need to output just the path of that node. I can output it using echo $node->field_link['und'][0]['node']->uri['path'] but I don’t want to hard code the ‘und’ and ‘0’ array keys in. There is presumably a way to do it with render().

If someone could point me in the right direction that’d be great, thanks.

Ben

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:28:19+00:00Added an answer on May 26, 2026 at 8:28 am

    You can’t do it with render but you don’t need to hard code the language code, you can get it from the global variables:

    global $language;
    echo $node->field_link[$language->language][0]['node']->uri['path']
    

    You won’t be able to get around using the 0 key though, all fields are stored with the potential to be multiple so you will always need to ‘pick’ which element you want to get.

    If the cardinality of your field is 1, you can always assume that the element you’re looking is for is at field_link[$language->language][0]. If not you’d need to run through each element in the und array and decide which one to display.

    EDIT

    You can also use the LANGUAGE_NONE constant (which will generally return ‘und’, but either way wil be the correct language code for the default content).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a new content type called 'A' which has a cck reference node
I have two content types (job_post and application) linked using the node reference +
I have an article content type with a node reference CCK field that links
I have parent/child relationship set up via Node Reference. A Child record can have
List -> l_user I have a List node that has a user-reference field (
Using cck I've created a new content type, Contact. A contact can have 1
I have a node with many CCK fields. I want to hide a field
In the sitemap file, I have sitemap Node URL which have more than 1
I have a binary tree where each node can have a value. I want
i have this problem to find a particular xml node l have post this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.