Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By janithpunna on
I want to get the drupal system url (eg: node/12352) from URL alias content/some-content.
Tried using
drupal_lookup_path('source',$path);
drupal_get_normal_path($path);
but both are not working. The value of $path is retrived as following
$tid = $user->field_job_category['und'][0]['tid'];
$jobcategory = drupal_lookup_path('alias', 'taxonomy/term/'.$tid);
$path = 'content/'.$jobcategory; // content/
Is there any solution?
Comments
Try this one
Hi
I would suggest you checking this thread right here:
http://stackoverflow.com/questions/703426/how-to-get-the-full-url-of-a-d...
Hope this works for you.
Need drupal system path of specific URL alias
Thanks for the reply. But that didn't solve my problem. I don't want to get the current url. I just want to get drupal path(eg: node/23423) of a specific URL alias (eg: content/title-of-some-content).
I want to get the system path of URL alias link given in last div (content/$term_alias), is that possible?
drupal_get_normal_path
drupal_get_normal_path returns node/nid if an internal/system path exists or the alias that you input if it doesn't.
not sure why you are showing taxonomy examples but "taxonomy/term/tid" is the internal/system path of a taxonomy term...
if you have set up an alias for a taxonomy term e.g. "myterm" then I believe drupal_get_normal_path should work for that too...and return taxonomy/term/tid
Thanks for the replies
Thanks for the replies the problem was with URL alias which gets update as per the language. Some how solved it