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

Jamie Holly hovercrafter at earthlink.net
Thu Jan 14 16:34:46 UTC 2010


Unless you are altering the registry, setting the status message won't 
show up on the current page, since they are already pulled in by 
template_preprocess_page (the first preprocess function). That means the 
message set in your preprocess function won't show up until the next 
page. Not sure if that's causing the problem or not, but it is something 
to keep in mind.

Jamie Holly
http://www.intoxination.net
http://www.hollyit.net


On 1/14/2010 11:14 AM, Khalid Baheyeldin wrote:
> 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 <mailto: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 <http://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/5c40c68a/attachment.html 


More information about the development mailing list