if (arg(0) == 'node' && ctype_digit(arg(1))) { // if the path is /node/some_number
// ...do something...
}
If you have aliased paths, arg() still uses the original drupal path. So, depending what you want to do, in some cases you may need to combine it with drupal_get_normal_path(), or the opposite, use drupal_get_path_alias() and split it yourself.
I think that depending on the context where you are using it, the variable $_REQUEST may need to be declared as global $_REQUEST; first. But I may be wrong about that.
Comments
One way is the arg()
One way is the arg() function.
http://api.drupal.org/api/function/arg/6
If you have aliased paths, arg() still uses the original drupal path. So, depending what you want to do, in some cases you may need to combine it with drupal_get_normal_path(), or the opposite, use drupal_get_path_alias() and split it yourself.
http://api.drupal.org/api/function/drupal_get_normal_path/6
http://api.drupal.org/api/function/drupal_get_path_alias/6
Thanks. This one works
Thanks. This one works well.. I have also looked at the Virtual Sites module which is also nice.. ;)
use $_REQUEST['q']
put this where ever you want on top of the page.? $argsArray Is an array cutting the URL?
Please let me know if it works.?
sharma
I tried this on my block
I tried this on my block tpl's and I only got Array ( [0] => ).. ;)
if you path is
if you path is http://drupal.org/handbooks
the array will be
Array ( [0] =>handbooks ).
try it in a block once..
sharma chelluri
I think that depending on
I think that depending on the context where you are using it, the variable $_REQUEST may need to be declared as
global $_REQUEST;first. But I may be wrong about that.Use it in a geniric block from admin side
Put this in geiric block not in any tpls for now.
sharma chelluri