By soezkan on
Hi there,
I wonder, how I get the node/id from a SEO friendly url like content/myhomepage?
I need the node/id to use it as an argument in my view. But how can I get the
node/id when my URL does not have it?
Thank you so much for a hint!
Soezkan
Comments
Hi Soezkan
Hi Soezkan
This is very easy if you want to use this in views.
Study this http://www.ridgesolutions.ie/index.php/2009/01/19/passing-an-argument-to...
I hope this help you a lot
Cheers
Devender
thanks for the reply and the
thanks for the reply and the link.
But I don't get what I am looking for.
How can I figure out which is the node/id
such as "node/1"?
I mean, at the moment my particular node appears in the URL
as "q=content/homepage" but it is equal with "q=node/1".
But I need the "1" (second argument) to work with. But I just
can't get it from the URL.
Any idea?
Thanks!
_
Where is it you're trying to use it? Usually views understands the canonical url without special handling. For example, if you're using the "node: nid" argument, you can select the 'node id from url' item in the 'provide default argument' settings and views will get the proper node id even if the page is aliased.
Thanks for replying. I found
Thanks for replying. I found a way to do that in views: I simply switched
of the pathauto/path modules and now my url shows the node/id.
But if you said it is possible that the views understand it withou
special handling I switch the pathauto-module on again.
But, supposing, I want to get within the page.tpl.php the node/id
while I use SEO friendly urls like content/myhomepage, how do
I do it then?
Thanks for more help :)
Soezkan
_
Simple:
See http://api.drupal.org/api/function/arg for more info.
thanks and, yes it works. But
thanks and, yes it works. But how can I get the "q=node/id" for the corresponding
SEO friendly path like "q=content/hoempage"?
Your suggestion works only if I have the path/pathauto module inactive.
Please help!
Thanks alot
Soezkan
_
nope, not true.
Solution
Anyone still looking for a solution, especially one that involves a view argument in the midst of a path like department/%/list see Node ID as View Argument from SEO-friendly URL Path