Sunday 14 October 2012

How to open pages or content node in Drupal 7 overlay.

hello all,

To open normal page or node in Drupal 7 overlay format.
You need to two things
1) add Overlay permissions to all user
2) create custom module.
    Create custom module custom_overlay.info file  and custom_overlay.module file. In custom_overlay.module file we are going to add code under hook_admin_paths_alter function.

In that function we assign TRUE value (i.e 1) to paths variable to open in  overlay format.
e.g. :-
$paths[PATH_TO_NODE] =1;
$paths[PATH_TO_PAGE] =1;

//Add below code in custom_overlay.module
/*
 * HOOK_admin_paths_alter
 */
function custom_overlay_admin_paths_alter(&$paths) {

 $paths['node/*'] = 1; // For all node
  $paths['node/2'] = 1; // For specific node
  $paths['user/*'] = 1; //all user page
  $paths['contact'] = 1; // For Contact page
  $paths['content/*'] = 1; // ALL node or page under content

}


Add Google web font externally in DRUPAL 7




Find the template.php in your custom theme folder edit the template.php and add this function

function mytheme_preprocess_html(&$variables) {
drupal_add_css('http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic&subset=latin,cyrillic', array('type' => 'external'));
}

NOTE:
 change the mytheme with your theme name!.

For more Check this Out...
http://blog.morethanthemes.com/post/9951799439/drupal-7-tutorial-adding-google-web-fonts-as-external

Sunday 2 September 2012

Integrate 9 facebook methods in your website like....


  1. How to integrate Facebook Connect in your website
  2. How to generate Facebook Login / Logout URL
  3. How to get extended permissions from users
  4. How to call graph api
  5. How to run FQL Query
  6. Publish Wall Post using PHP
  7. Publish Wall Post using Facebook Javascript API
  8. Invite friends using Facebook Javascript API
  9. No Facebook Javascript only use PHP SDK
To integrate above Methods refers this website...

Thursday 14 June 2012

Import/Export Large MYSQL Databases


Take dataBase
mysqldump -u [USERNAME] -p [DBNAME] | gzip > [/path_to_file/DBNAME].sql.gz

To take structure of database
mysqldump -u [USERNAME] -p [DBNAME] --no-data | gzip > [/path_to_file/DBNAME].info.sql.gz




To Take dataBase withOut caches table
mysqldump -u [USERNAME] -p [DBNAME] --no-create-info --ignore-table=[DBNAME].search_index --ignore-table=[DBNAME].cache --ignore-table=[DBNAME].cache_block --ignore-table=[DBNAME].cache_content --ignore-table=[DBNAME].cache_filter --ignore-table=[DBNAME].cache_form --ignore-table=[DBNAME].cache_menu --ignore-table=[DBNAME].cache_mollom --ignore-table=[DBNAME].cache_page --ignore-table=[DBNAME].cache_pathdst --ignore-table=[DBNAME].cache_pathsrc --ignore-table=[DBNAME].cache_views | gzip > [/path_to_file/DBNAME].data.sql.gz;

To learn more follow this link:
http://www.lullabot.com/blog/importexport-large-mysql-databases

Wednesday 13 June 2012

List of importance modules


In the interest of discovering automatically which Drupal modules are the most important to know about, I compiled some statistics. I used a google-like method of quantifying importance: I counted the number of times each module was linked to in the descriptions of other modules (including sandbox projects). The data were gathered yesterday, 11/29/11 from drupal.org. Here is the top 200:
Rank Module Frequency
1 Views 265
2 Content Construction Kit (CCK) 145
3 Ubercart 118
4 Drupal Commerce 117
5 Webform 94
6 Feeds 87
7 Rules 82
8 Embedded Media Field 81
9 Libraries API 78
9 Chaos tool suite (ctools) 78
11 Token 75
12 Features 72
13 Context 62
14 ImageCache 60
15 Media 58
16 Services 56
17 Wysiwyg 53
17 Organic groups 53
17 jQuery Update 53
20 ImageField 50
21 Drush 49
21 Domain Access 49
23 FileField 45
23 Apache Solr Search Integration 45
25 Search API 44
25 Panels 44
27 Date 39
28 jQuery UI 38
29 e-Commerce 35
30 Entity API 33
31 Pathauto 32
31 Image 32
33 Views Bulk Operations (VBO) 31
34 Location 30
35 Flag 29
36 OpenLayers 26
36 FeedAPI 26
38 User Points 24
38 Display suite 24
40 Voting API 22
40 SMS Framework 22
40 Link 22
43 Workflow 21
44 Internationalization 20
44 Devel 20
44 Content Profile 20
47 Simplenews 19
47 Signup 19
47 Notifications 19
50 Relation 18
50 Migrate 18
50 Debut 18
50 CAPTCHA 18
54 Quiz 17
54 Nodequeue 17
54 Lightbox2 17
57 Gallery Assist 16
57 Content Access 16
59 Node Gallery 15
59 Search Lucene API 15
59 GMap Module 15
62 Views Slideshow 14
62 Privatemsg 14
62 Pay 14
62 Menu block 14
62 jCarousel 14
62 Insert 14
62 Feed Element Mapper 14
62 Administration menu 14
62 ACL 14
71 Twitter 13
71 Support Ticketing System 13
71 SOAP Client 13
71 References 13
71 Nodewords 13
71 Modal Frame API 13
71 FileField Sources 13
71 Case Tracker 13
71 Admin 13
80 Version Control API 12
80 User Relationships 12
80 Media Mover 12
80 Field group 12
80 Boxes 12
80 Bibliography Module 12
86 Universally Unique IDentifier 11
86 Taxonomy Access Control 11
86 Strongarm 11
86 Project 11
86 Profile 2 11
86 Messaging 11
86 ImageAPI 11
86 Diff 11
86 Commerce Shipping 11
86 Coder 11
86 Advertisement 11
97 Transliteration 10
97 Thickbox 10
97 OAuth 10
97 jQ 10
97 IMCE 10
97 Fivestar 10
97 Drupal for Facebook 10
97 Facet API 10
97 Facebook-style Statuses (Microblog) 10
97 E-mail Marketing Framework 10
97 Email Field 10
97 Deployment 10
97 Content Taxonomy 10
97 Browscap 10
97 Bot 10
97 Boost 10
97 Bad judgement 10
114 ThemeKey 9
114 Taxonomy menu 9
114 Salesforce Suite 9
114 Resource Description Framework (RDF) 9
114 QueryPath 9
114 Mailhandler 9
114 Hierarchical Select 9
114 Google Analytics 9
114 Geofield 9
114 Faceted Search 9
114 Country Icons 9
114 Colorbox 9
114 CKEditor - WYSIWYG HTML editor 9
114 Google chart API 9
114 CDN 9
114 Auto Assign Role 9
114 Activity Stream 9
131 Yahoo YUI 8
131 XML sitemap 8
131 Vote Up/Down 8
131 UC Recurring Payments and Subscriptions 8
131 Scheduler 8
131 Node import 8
131 Mobile Tools 8
131 Mime Mail 8
131 LDAP integration 8
131 Lightweight Directory Access Protocol 8
131 Instant Operating System 8
131 Invite 8
131 Geo 8
131 FileField Paths 8
131 Feeds XPath Parser 8
131 Event 8
131 Drush Make 8
131 Drupal Queue 8
131 Backup and Migrate 8
131 Autoload 8
131 Utilities 8
131 Advanced help 8
131 Advanced CSS/JS Aggregation 8
154 Views Bonus Pack 7
154 Taxonomy Image 7
154 Taxonomy Access Control Lite 7
154 Tabs (jQuery UI tabs) 7
154 Storm 7
154 Spaces 7
154 Shadowbox 7
154 Service links 7
154 Printer, e-mail and PDF versions 7
154 Prepopulate 7
154 Popups API (Ajax Dialogs) 7
154 Piwik Web analytics 7
154 Page Title 7
154 OpenCalais 7
154 Node clone 7
154 Nodeaccess 7
154 MERCI (Manage Equipment Reservations, Checkout and Inventory) 7
154 Memcache API and Integration 7
154 Kit 7
154 GeSHi Filter for syntax highlighting 7
154 FriendList 7
154 Facebook Connect 7
154 DraggableViews 7
154 Bbcode 7
154 Actions 7
179 Zend Framework 6
179 VoIP Drupal 6
179 Views Datasource 6
179 Video 6
179 Vertical Tabs 6
179 Usernode 6
179 Twitter Pull 6
179 Table Wizard 6
179 TinyMCE 6
179 Spam 6
179 Secure Pages 6
179 Revisioning 6
179 RealName 6
179 Project issue tracking 6
179 Profile Privacy 6
179 Node access user reference 6
179 Nice Menus 6
179 Derivatives API 6
179 Magento 6
179 Linkit 6
179 Keyword Research 6
179 Javascript Tools 6
179 Job queue 6

Tuesday 12 June 2012

XAMPP on 64 Unix Operating Systems

hello all,

If you have a 64-bit unix like operating system you cant run the Xampp because Xampp currently doesn’t have a 64-bit compiled version. Now what will you do in this condition ?
When you are trying to start a lampp from terminal you might be getting this kind of error:: XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library for your system. Dont worry this is just a simple validation code in /opt/lampp in lampp file on line number 86. Now we will run the xampp under 64-bit operating system even though it is not supporting the 64-bit compiled version.
Please follow the steps in order to start your xampp with 64-bit operating system.

1) Comment the lines in /opt/lampp lampp file from 78 to 90.

     which will now look like this

# XAMPP is currently 32 bit only
#case `uname -m` in
#    *_64)
#    if /opt/lampp/bin/php -v > /dev/null 2>&1
#    then
#        :
#    else
#        $de && echo "XAMPP gibt es zur Zeit nur als 32-Bit Applikation. Bitte verwende eine 32-Bit Kompatibilitaetsbibliothek fuer Dein System."
#        $de || echo "XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library for your system."
#        exit
#    fi
#    ;;
#esac


2) Open your terminal (if it is ubuntu 10.10 go to Appllication>>Accessories>>Terminal enter this command sudo apt-get install ia32-libs if it is asking for root password then enter the password, wait till it downloads all of the 32-bit libs.

3)
Once it is done just enter the following command at the terminal /opt/lampp/lampp start

Thats It!!! now you are free to use the xampp under 64-bit operating system.


Enjoy & be open.
long live linux

Sunday 10 June 2012

working with Curl PHP

  <?php
 //login start
        set_time_limit(0);

        //$php_userid = "admin";//$_POST['login'];
        //$php_password = "dD82slk7!";//$_POST['passwd'];


        $cookie_file_path = "cookie.txt"; // Please set your Cookie File path


        $fp = fopen($cookie_file_path,'wb');
        fclose($fp);
        $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
        $reffer = "http://127.0.0.1/example/user/";
        $LOGINURL = "http://127.0.0.1/example/user/";

        $POSTFIELDS = 'name=admin&pass=htpass123&op=Log in&form_id=user_login';       
    

/* Initialize the cURL session*/
     $ch = curl_init();


/* Set the URL of the page or file to download.*/
        curl_setopt($ch, CURLOPT_URL,$LOGINURL);
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_REFERER, $reffer);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);


/**
* Execute the cURL session
*/
//$contents = curl_exec ($ch) or die(curl_error());


        $result = curl_exec ($ch);

      // echo curl_exec ($ch);
    $response = curl_getinfo($ch);
    //print_r($response);


/**
* Close cURL session
*/

    curl_close ($ch); 
    print_r($result);
            //login ends

Download file or web page using PHP cURL and save it to file

The below PHP code is a slight variation of the above code. It not only downloads the contents of the specified URL but also saves it to a file.

/**
* Initialize the cURL session
*/
$ch = curl_init();
/**
* Set the URL of the page or file to download.
*/
curl_setopt($ch, CURLOPT_URL,
'http://news.google.com/news?hl=en&topic=t&output=rss');
/**
* Create a new file
*/
$fp = fopen('rss.xml', 'w');
/**
* Ask cURL to write the contents to a file
*/
curl_setopt($ch, CURLOPT_FILE, $fp);
/**
* Execute the cURL session
*/
curl_exec ($ch);
/**
* Close cURL session and file
*/
curl_close ($ch);
fclose($fp);
?>

Thursday 31 May 2012

How To Guide : Tata Docomo 3G on Ubuntu 11.10

It's pretty straight forward and follow below steps.
1. Connect your 3G stick and boot up Ubuntu.
2. Select network connections and click on the New Mobile Broadband Connection.
3. Now select continue in the dialog box and select India as country & then click continue.
4. Now it wil show list of service providers and DON'T select "Tata Docomo" as it's for Photon+ not for 3G. Instead select, I don't know my provider option and enter "TATA DOCOMO UMTS", click continue.
5. Under billing dialog, select "My plan is not listed" option and enter "tatadocomo3g" as APN, just click confirm and save your settings.
6.  Now under Network Connections, you could see "TATA DOCOMO UMTS connection" option and you can click on it. If it doesn't connetc to internet then just unplug & then re-plug you 3G stick.
That's it, you can use Tata Docomo 3G stick with your Ubuntu 11.10 :)

Monday 14 May 2012

How to Make Optionally Hidden Node Titles in Drupal (Using CCK)

To Make Optionally Hidden Node Titles in Drupal (Using CCK)
http://addoa.com/blog/how-make-optionally-hide-node-titles-drupal-using-cck

           -------------OR-------------
Now  to do this functionality  we have Drupal Module.
This module handles a very simple functionality, decide whatever to exclude a node title from full node page or node teasers.
http://drupal.org/project/exclude_node_title

Step By Step Instructions To Enable Clean URLs in Drupal

By default, Wamp Server doesn't support clean url feature of drupal cms.
To enable Clean URLs we need to manually edit the httpd.conf file of Apache server to support this feature.

1. Start WAMP Server. Click on the WAMP Server icon in the tray. Go to Apache -> httpd.conf as shown in the image below.
2. Find the following line in the httpd.conf file
   #LoadModule rewrite_module modules/mod_rewrite.so
3. Just remove the # symbol in the beginning of that line. Now it looks like in the below line.
    LoadModule rewrite_module modules/mod_rewrite.so
4. Now save the httpd.conf file and Restart your Wamp Server. Then open your browser and enable Clean URLs in your drupal cms.
   Enable Clean URLs From admin -> siteconfiguration.

sort an associative array by one of its keys

In case you need to sort an associative array by one of its keys, this function might be useful:

<?php
function sortByOneKey(array $array, $key, $asc = true) {
   
$result = array();
       
   
$values = array();
    foreach (
$array as $id => $value) {
       
$values[$id] = isset($value[$key]) ? $value[$key] : '';
    }
       
    if (
$asc) {
       
asort($values);
    }
    else {
       
arsort($values);
    }
       
    foreach (
$values as $key => $value) {
       
$result[$key] = $array[$key];
    }
       
    return
$result;
}

?>

Consider the following example:

<?php

$users
= array(
   
1 => array('name' => 'John', 'age' => 35),
   
2 => array('name' => 'Alice', 'age' => 23),
   
3 => array('name' => 'Bob', 'age' => 26)
);
       
$sortedByNameAsc = sortByOneKey($users, 'name');
$sortedByNameDesc = sortByOneKey($users, 'name', false);
       
echo
"Sorted by Name in ascending order: ";
echo
"<pre>" . print_r($sortedByNameAsc, true) . "</pre>";
echo
"<br /><br />Sorted by Name in descending order: ";
echo
"<pre>" . print_r($sortedByNameDesc, true) . "</pre>";

?>

The output will be the following:

Sorted by Name in ascending order:
Array
(
    [2] => Array
        (
            [name] => Alice
            [age] => 23
        )

    [3] => Array
        (
            [name] => Bob
            [age] => 26
        )

    [1] => Array
        (
            [name] => John
            [age] => 35
        )

)

Sorted by Name in descending order:
Array
(
    [1] => Array
        (
            [name] => John
            [age] => 35
        )

    [3] => Array
        (
            [name] => Bob
            [age] => 26
        )

    [2] => Array
        (
            [name] => Alice
            [age] => 23
        )

)