Tuesday, October 4, 2011

List out some functions in template.php

phptemplate_body_class($left, $right)
phptemplate_breadcrumb($breadcrumb)
phptemplate_preprocess_page(&$vars)
garland_preprocess_comment_wrapper(&$vars)
phptemplate_menu_local_tasks()
phptemplate_comment_submitted($comment)
phptemplate_node_submitted($node)
phptemplate_get_ie_styles()

theme_preprocess_node(&$vars) {
theme_preprocess_page(&$vars) {
theme_preprocess_block(&$vars) {
theme_filter_tips_more_info()
theme_filter_tips()
theme_button($element) {

Monday, October 3, 2011

Diff between UNSET and UNLINK.

unlinkDeletes a file

unset — Unset a given variable

List out curl functions in PHP

The following function are used to call CURL in php,
curl_init() - Initialize a cURL session
curl_setopt() - Set an option for a cURL transfer
curl_exec() - Perform a cURL session
curl_close() - Close a cURL session
curl_errno() - Return the last error number
curl_error() - Return a string containing the last error for the current session
curl_version() - Gets cURL version information
curl_getinfo() - Get information regarding a specific transfer

Example:

$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>

List out the drupal query functions

The following query functions are used in
db_connect - Initialize a database connection.
db_query - Execute query
db_result - Return an individual result field from the previous query.
db_affected_rows - Determine the number of rows changed by the preceding query.
db_rewrite_sql - Rewrites node, taxonomy and comment queries. Use it for listing queries
db_create_table -Create a new table from a Drupal table definition.
db_field_names - Return an array of field names from an array of key/index column specifiers.
db_query_range - Runs a limited-range query in the active database.
db_fetch_array - Fetch one result row from the previous query as an array
db_fetch_object - Fetch one result row from the previous query as an object.
db_error - Determine whether the previous query caused an error.
db_lock_table - Lock a table.
db_unlock_tables - Unlock all locked tables.
db_table_exists - Check if a table exists.
db_column_exists - Check if a column exists in the given table.

Manage MySQL using shell scripting.

Connect MySQL : mysql -h -u -p
Create a DB: mysql> create database
Use a DB for operate: mysql> use
Show all databases: mysql> show databases;
Show the running quries: mysql> process list
Kill the query: mysql> kill