By rvk on
Is it possible to create a link to a node using noderef that will link to the path that has been created using path (and/or pathauto). I tried, but I was only able to find the node ID so I could only make a link like www.example.com/node/1 instead of www.example.com/path-created-by-pathauto
rvk
Comments
Given the node id and the
Given the node id and the l() function (that's a lower case L) you can do something like
and the resulting link will use the path alias if there is one.
thanks I'll give that a try!
thanks I'll give that a try!
added a missing ")" print
added a missing ")"
and it works except that it ignores $nid
but when I use e.g. "node/5" it works fine! So almost there...
I tried this out in a page... is that my problem maybe?
You will need to set $nid,
You will need to set $nid, your original post suggested you already add access to it.
Thanks, sorry but that was
Thanks, sorry but that was more me struggling with PHP. I know how to get $nid using noderef and contemplate, but I assumed it also to be a global variable when viewing any test page. That apparently is not the case...
Thanks for your help!
Solution
Hi,
I have the exact same problem you had last year.
l($content->title, "node/$nid")
only creates a link to ../node/
It ignores the $nid.
It seems when i read the thread that you have solved the problem, if so could you please share you solution?
Thankx