I have given my blog entries URL's in PathAuto like this: /blog/5/200806/389 where:
5 is UID of author 200806 is June, 2008 389 is nid
I want to create a block on the right margin which will have links such as member's blog, member's recent entries, member's most read blogs, etc which will all link to Views I've already set up.
I thought I could use args to extract the UID from the URL but when I print out all arguments in the block as a test, I get only "node" and "389" so it's not seeing the PathAuto URL but the system URL.
What I was hoping to do, paraphrased, is
where arg0 is blog and arg1 is numeric arg1 equals $uid <a href="/blog/$uid">Member's Blog</a>
also though, in that snippet, how would I load the user's name? I guess what I'd really want to do is load the user so I'm able to extract uid, name, picture, etc and use arg1 to do it, but I can't get the PathAuto created URL parameters, only the core system ones.
any help appreciated.
Neil
I thought I could use args to extract the UID from the URL but when I print out all arguments in the block as a test, I get only "node" and "389" so it's not seeing the PathAuto URL but the system URL.
Correct.
To get the uid use node_load to load the node details. If you use print_r() to examine the results, you will see that uid is one of the entries in the returned array. So something like:
$node = node_load(arg(1)); $uid = $node['uid'];
HTH
Thanks Fred. That did the trick.
Neil
----- Original Message ----- From: "Fred Jones" fredthejonester@gmail.com To: support@drupal.org Sent: Wednesday, June 25, 2008 10:20 AM Subject: Re: [support] extracting author's UID from URL for use in a block
I thought I could use args to extract the UID from the URL but when I print out all arguments in the block as a test, I get only "node" and "389" so it's not seeing the PathAuto URL but the system URL.
Correct.
To get the uid use node_load to load the node details. If you use print_r() to examine the results, you will see that uid is one of the entries in the returned array. So something like:
$node = node_load(arg(1)); $uid = $node['uid'];
HTH
[ Drupal support list | http://lists.drupal.org/ ]