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

Khalid Baheyeldin kb at 2bits.com
Thu Jan 14 16:14:54 UTC 2010


Call me old school, but calling the same function with the same argument
twice in a row is wasteful. I see this tendency to just call the same thing
a lot rather than storing it in a variable and reusing it, and I don't like
it.

$a0 = arg(0);
$a1 = arg(1);
$path = "$a0/$a1";
drupal_set_message('stuff' . $path);
$variables['nancy'] = $hook . $path;

This does not address why you are seeing what you are seeing. Use a debugger
like xdebug to see what really is going on there.

On Thu, Jan 14, 2010 at 10:49 AM, Nancy Wichmann <nan_wich at bellsouth.net>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?
>
>
>
>
>
> Nancy E. Wichmann, PMP
>
> Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L.
> King, Jr.
>
>
>



-- 
Khalid M. Baheyeldin
2bits.com, Inc.
http://2bits.com
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
Simplicity is the ultimate sophistication. --   Leonardo da Vinci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100114/59d10ac7/attachment.html 


More information about the development mailing list