Chaitanya Lakshmi
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook

Exaplin !, @ and % with Examples?

3/8/2012

0 Comments

 
!variable, which indicates that the text should be inserted as-is. This is useful for inserting variables into things like e-mail.
<?php
    $message = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => l(t('My account'), "user/$account->uid"))); 
?>

@variable, which indicates that the text should be run through check_plain, to escape HTML characters. Use this for any output that's displayed within a Drupal page.

<?php
    $title = t("@name's blog", array('@name' => $account->name));
?>

%variable, which indicates that the string should be HTML escaped and highlighted with theme_placeholder() which shows up by default as emphasized.

<?php
    $message = t('%name-from sent %name-to an e-mail.', array('%name-from' => $user->name, '%name-to' => $account->name));
?>
0 Comments

What is the usage of !, @ and % attributes in t() Druapl?

3/8/2012

1 Comment

 
  • !variable: Inserted as is. Use this for text that has already been sanitized.
  • @variable: Escaped to HTML using check_plain(). Use this for anything displayed on a page on the site.
  • %variable: Escaped as a placeholder for user-submitted content using drupal_placeholder(), which shows up as <em>emphasized</em> text.
1 Comment

What does hook_exit() will do in drupal?

3/8/2012

0 Comments

 
Perform cleanup tasks.

This hook is run at the end of each page request. It is often used for page logging and printing out debugging information.

Only use this hook if your code must run even for cached page views. If you have code which must run once on all non cached pages, use hook_init instead. Thats the usual case. If you implement this hook and see an error like 'Call to undefined function', it is likely that you are depending on the presence of a module which has not been loaded yet. It is not loaded because Drupal is still in bootstrap mode.

Parameters $destination: If this hook is invoked as part of a drupal_goto() call, then this argument will be a fully-qualified URL that is the destination of the redirect. Modules may use this to react appropriately; for example, nothing should be output in this case, because PHP will then throw a "headers cannot be modified" error when attempting the redirection.

Return value None.

0 Comments

What is hook_preprocess() in Drupal?

2/29/2012

0 Comments

 
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

Differences between hook_boot() and hook_init() in Drupal?

2/29/2012

1 Comment

 
  1. hook_boot() is called before modules or most include files are loaded into memory (1.e., This hook will called while Drupal is still in bootstrap mode).
  2. hook_init()  is called After all modules are loaded into memory.


  1. hook_boot() is called event though the pages / Views got cached.
  2. hook_init() will not run on cached Pages.

1 Comment

What is custom_url_rewrite_outbound in Drupal?

2/29/2012

0 Comments

 
Syn: custom_url_rewrite_outbound(&$path, &$options, $original_path)

  1. custom_url_rewrite_outbound is not a hook, it's a function.
  2. You can add to settings.php to alter all links generated by Drupal.
  3. This function is called from url().
  4. This function is called very frequently (100+ times per page) so performance is critical.

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.

0 Comments

What is custom_url_rewrite_inbound in Drupal?

2/29/2012

0 Comments

 
Syn: custom_url_rewrite_inbound(&$result, $path, $path_language)

  1. custom_url_rewrite_inbound is not a hook, it's a function.
  2. You can add to settings.php to alter incoming requests so they map to a Drupal path.
  3. This function is called before modules are loaded and the menu system is initialized and it changes $_GET['q'].

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.

0 Comments

What is a Hook?

2/29/2012

0 Comments

 
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.
0 Comments

How to add new column after installing Module in Drupal?

2/28/2012

0 Comments

 
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;
?>
0 Comments

[SOLVED] HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917) Line: 0 Char: 0 Code: 0

2/22/2012

3 Comments

 
Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917) Line: 0 Char: 0 Code: 0

If you face this issue. Just do the below steps.

1. Check whether you have any Popup page in you website.
    Like Thickbox, Lightbox, etc..

2. Don't open the popups directly in the pages.

3. Open the Popups inside the Document Ready state.
   Example:

$(document).ready(function(){
  open_thickbox('logout/popup', 450, 600, true, true);
});

4. This solution for IE related browsers only. Because Firefox and other browsers will not trigger this issue.

5. This solution for IE7, IE8 etc..

6. Enjoy.. ! If you still face issue .. Please post comments here.. !!
3 Comments
<<Previous

    Archives

    April 2012
    March 2012
    February 2012

    Categor

    All
    Ajax
    Api
    Cross Site Scripting
    Css
    Curl
    Design Patterns
    Drupal
    Exception Handling
    Htaccess
    Html
    Javascript
    Jquery
    Json
    Linux
    Mysql
    Oops
    Php
    Regular Expressions
    Web 2.0
    Webservices
    Wordpress
    Xhtml

    RSS Feed

Powered by Create your own unique website with customizable templates.