I want to be able to pass an id to a function and get the full url.

I have two assumptions:
1) this function exists already
2) if it does not, there is a field for each node in the DB that holds this path...

If the function does not exist (and i presume it does since $node_url exists) what is the name of the row in the DB that would hold this?

I'm trying to get the url to a taxonomy term as well as that term's image from taxonomy_images. I've so far, with the use of views, created a query string to pull out the following:

SELECT node.nid AS nid, term_data.tid AS term_data_tid, term_image.path AS term_image_path, term_image.tid AS term_image_tid, term_data.name AS term_data_name, term_data.vid AS term_data_vid FROM node node  LEFT JOIN term_node term_node ON node.vid = term_node.vid LEFT JOIN term_data term_data ON term_node.tid = term_data.tid LEFT JOIN term_image term_image ON term_node.tid = term_image.tid

and can obviously work with the data being given to me. ultimately i'd like to be able to get the full path for both the term and the image from a single db call by asking for another row

Comments

kennethDavid’s picture

appreciate the links. unfortunately none of those are working for what i need. the first one returns the tid with a slash, the second just the tid, and the third nothing.

i may have to hard code the objects file paths up to their names... thanks to url alias the term url is just the name of the term, and the images i can get their file names... so, i can work around this issue. I'd just like to be able to code it in such a way that if those items get updated somehow that i won't have to come in and fix them in the code

zachwass2000’s picture

I am also having a similar problem. I would like to be able to get a url for a node knowing only the nid which was retrieved from a DB call. The functions listed above appear to have different functionality than what's needed.

jaypan’s picture

The non-aliased URL will always be node/[nid]

If you want the alias, you use drupal_get_path_alias('node/[nid]');

You will need to replace [nid] with the node id.

Contact me to contract me for D7 -> D10/11 migrations.

zachwass2000’s picture

This is just what I needed. Thank you.