In Drupal the ubiquitous "t" function is used to translate strings to a page language or a given user language. As such in module writing the "t" function should be used extensively to encapsulate all user readable text.
The "t" function works with special placeholders that signal "dynamic information" in a string that needs "extra" filtering or should not be filtered or translated at all, such as URLs. There are three different placeholders that offer three different exceptions to the normal operation of "t".
| Placeholder | Description |
|---|---|
| ! | Prevents all manipulation by "t", text is inserted as is. |
| Function Name | Description |
|---|---|
| actions_do | |
| actions_list | |
| actions_get_all_actions | |
| actions_actions_map | |
| actions_function_lookup | |
| actions_synchronize | |
| actions_save | |
| actions_load | |
| actions_delete | |
| _batch_page | |
| _batch_start | |
| _batch_progress_page_js | |
| _batch_do | |
| _batch_progress_page_nojs | |
| _batch_process |
drupal_goto($path = '', $query = NULL, $fragment = NULL,
$http_response_code = 302)
This simple function initiates an immediate redirect of the user to the URL indicated. The function contains additional parameters to handle complex URL building and supports RFC 2616 by registering an HTTP code for the redirect.
The parameters are parsed by this code fragment:
$url = url($path, array('query' => $query, 'fragment' => $fragment, 'absolute' =>
TRUE));
The array is relatively straight forward with the [0] element as the actual address, and the query(if any) loaded into an associative part of the array and the fragments(if any) also loaded into an associative part of the array.
The PHP function 'header()' does the heavy lifting in the function by setting the destination and giving the response code to the users browser:
header('Location: '. $url, TRUE, $http_response_code);
This section of the guide will cover specific functions within the Drupal 6 API in a way that hopefully sheds more light on their common use.
After registering an account with the site, you may decide you want to go with a brighter theme than the default. So the site has been populated with about a dozen alternative themes that you can set from your user account.
To do this:
Your default theme is now changed whenever you log in.
NOTE: You may have trouble viewing all of the "extra" content with a non-standard theme.
This book covers how to use some of the sophisticated features of the site.
So it's important to understand early on that Drupal strives for a 'secure' and 'reliable' architecture and does so by separating the core code from user generated and contributed code. All the editable code is kept in the /sites folder of a Drupal installation. In a single site installation all this modular code is kept in /sites/all/modules or /sites/all/themes. One of the most common beginner mistakes is to look inside the new Drupal directory and use the /modules or /themesdirectory for storing downloaded modules and custom code.
The root /modules directory holds the modules that have been incorporated in the core Drupal release, this directory and all directories outside of /sites should be left alone. Drupal provides ample ways to override the behavior of the core code, and using the API's is vastly more secure and reliable than altering core code.
Similarly to loosing the user login page, it's not uncommon to remove the navigation links and blocks and suddenly you can't easily logout of a Drupal site. The answer to that is also to append a page callback to the address bar of your browser, either:
http://www.mysite.com/logout
or
http://www.mysite.com/?=logout
if you don't have clean URLs turned on.
Explanation:
Same as for the lost user login block, a 'page callback' invokes a function which logs the user out of the site(see Can't login to Drupal).