[development] So confused about arg(...)

Earl Miles merlin at logrus.com
Thu Jan 14 16:46:31 UTC 2010


Nancy Wichmann wrote:
> I’m working on a hook_preprocess_page and it seems to be behaving 
> strangely. I have:
> 
>   drupal_set_message(‘stuff ‘. arg(0) . ‘/’ . arg(1));
> 
>   $variables[‘nancy’] = $hook . arg(0) . ‘/’ . arg(1);
> 
> In exactly that order, with no intervening lines.
> 
>  
> 
> Displaying the variable in the page.tpl.php shows “page taxonomy/term” 
> but the message shows “stuff r/ms” (even if I refresh the page, or clear 
> the cache). How can this be happening?

Because you're doing this in the page template, please note that your 
dsm() will be one refresh behind.

I'm not sure that you've pasted the exact code you're using -- there's 
no space, for example, in your $hook . arg(0) but you show one in your 
output. I realize that is a trivial difference but it immediately makes 
me wonder if there are other trivial differences that may not be so trivial?


More information about the development mailing list