[development] So confused about arg(...)
Earl Miles
merlin at logrus.com
Thu Jan 14 16:50:09 UTC 2010
Earl Miles wrote:
> 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.
Oh I meant to explain this.
$messages is built in template_preprocess_page(). You're running in
THEME_preprocess_page() which runs after template_preprocess_page().
$messages is already constructed, so anything you put in dsm() will go
into the $_SESSION variable and show up in the NEXT processing of $messages.
More information about the development
mailing list