[themes] User info in blocks

Florian Loretan floretan at gmail.com
Thu Feb 7 23:20:53 UTC 2008


> Have you looked into the "Page specific visibility settings" for this particular
> block's configuration page?  You can goto this configuration page by clicking
> the "configure" link next to the block's name in admin/build/block.

These configuration options let you decide on what page you want the
block to be displayed. However, if your block is dependent on some
context-related data, it is up to you to handle how you access that
data and to make sure that you never use invalid data or you'll break
your site.

For example, if you use arg(1) to get the nid of the current node
which you will load with node_load() it will work on /node/123, but if
you display that block on a page where arg(1) returns a string like
/blog/john you will call node_load('john') and get a "white screen of
death".

Another example from a core module is the login block: you choose
where you want it displayed, but the code generating the block makes
sure that it is only displayed for anonymous users.


More information about the themes mailing list