Syn: hook_preprocess(&$variables, $hook)
hook_preprocess used to Preprocess theme variables for template files. This hook allows modules to preprocess theme variables for theme templates. It is only called for theme hooks implemented as template files, but not for those implemented as theme functions. The purpose of this hook is to allow modules to add to or override variables for all template files. Parameters: $variables: The variables array (modify in place). $hook: The name of the theme hook.
0 Comments
Syn: custom_url_rewrite_outbound(&$path, &$options, $original_path)
This function should change the value of $path and $options by reference. Parameters: $path: The alias of the $original_path as defined in the database. If there is no match in the database it'll be the same as $original_path $options: An array of link attributes such as querystring and fragment. See url(). $original_path: The unaliased Drupal path that is being linked to. Syn: custom_url_rewrite_inbound(&$result, $path, $path_language)
This function should change the value of $result by reference. Parameters: $result: The Drupal path based on the database. If there is no match in the database it'll be the same as $path. $path: The path to be rewritten. $path_language: An optional language code to rewrite the path into. Hook Allow modules to interact with the Drupal core.
Drupal's module system is based on the concept of "hooks". A hook is a PHP function. Each hook has a defined set of parameters and a specified result type.
Using a hook_update_n() function we can able to add New Columns to the table.
Here, 'n' represents the number. Suppose if we want to add a new column called 'newcol' to mytable1. First, we have to update our schema structure in modulename_schema() so that newly created tables get the new column. Then, add an update function to modulename.install: <?php function modulename_update_1() { $ret = array(); db_add_field($ret, 'mytable1', 'newcol', array('type' => 'int')); return $ret; ?> PHP supports libcurl, a library that allows you to connect and communicate to many different types of servers with many
different types of protocols. LIBCURL (CURL LIBRARY PHP)currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. LIBCURL (CURL LIBRARY PHP) also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP’s ftp extension), HTTP form based upload, proxies, cookies, and user plus password authentication curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.
A typical PHP cURL usage follows the following sequence of steps. curl_init – Initializes the session and returns a cURL handle which can be passed to other cURL functions. curl_opt – This is the main work horse of cURL library. This function is called multiple times and specifies what we want the cURL library to do. curl_exec – Executes a cURL session. curl_close – Closes the current cURL session. Below are some examples which should make the working of cURL more clearer. The below piece of PHP code uses cURL to download Google’s RSS feed. AJAX requests should use an HTTP GET request when retrieving data where the data will not change for a given request URL. An HTTP POST should be used when state is updated on the server. This is in line with HTTP idem potency recommendations and is highly recommended for a consistent web application architecture.
|