CNN Style 'Alert' in Drupal?
I'm sure most of you have seen开发者_运维知识库 the CNN type alerts, the ones that flash at the top of the screen when the administrators want to. Is this already done in Drupal?
I am thinking you would need some kind of jQuery for the animation, simple enough, but what mechanism would you need to allow the user to X the alert away, and not show it again?
If the messages are only set by administrator users, then you can be interested to Admin message that is described as:
Provides an easy way to show short messages to users. The messages can be individually closed by logged in users. Examples could be "Welcome to this site...", "Temporary downtime...", "Important security announcement...", "New feature...", etc.
By default messages that are created before a user registered is not shown to that user, something that can be overridden by an "Always show this message"-option. Also, a PHP visibility option, similar to the display option used for blocks, is available for each message. This can be used for example to only show a message for users of a specific role, show a message if a user has not filled a profile field, etc.
Another option would be to setup a custom region in your theme, then move blocks, etc. into that theme when you want them to be displayed.
Context works well with this.
I cant answer as to the specifics of drupal but in most cases something like that would be attained using cookies. If you wanted to handle the cookies in jQuery the easiest solution is this plugin.
Hope that helps somewhat!
精彩评论