To show welcome message in Drupal we can identify whether user is logged in or not using simple code snippet below. You can write this code in either block or custom module which adds block or create a variable in template.php to use in a template:
Just came across a situation, where wanted to alter the allowed values in views exposed filter depending on users who are viewing them.
View allows site admin to expose its filter value to user, so they can apply different filters while viewing views output. But what if you need to show the allowed list depending on users.
Webform module provides a way to create forms, which can be used as contests, personalized contact forms, or petitions, etc. One of the recent form which I've created using webform is a Feedback form in site I've built.
Webform module provide support for showing the webform as a block, which extends webform modules functionality to be shown anywhere on a page.
Here's a sample code to render a webform programatically:
Ever wanted to retrieve a list of allowed values of select list, here's a sample code:
Blocks are the boxes of content (such as "User Login" or "Who's online") that can be displayed in regions (such as footer or sidebar) on your page.
Blocks are made available to your site most commonly by enabling modules. Once created, a Block can be modified to adjust its appearance, shape, size and position - or which Website pages it appears on.
There are some cases where you want to render block within content of page or part of node body. Here is sample code to render the blocks programmatically in Drupal 7.
In Drupal the normal functionality of multi-value field on node edit screen is like this, it adds one more extra row where user can add data if they want or leave as it is if don't.
Views can be used to display content as a page, block, etc. You can directly access URL to show page view content, you can add views block in any region if it is to be shown on sidebar first, sidebar second, content top, content bottom. What if the content of views block needs to be shown inside the content of page. So here is sample code to render the views programmatically in Drupal 7 in just one line: