Showing posts with label Drupal7. Show all posts
Showing posts with label Drupal7. Show all posts

Tuesday, January 29, 2013

How to autopost content from my site to facebook

How to autopost content from any site to facebook page.
first of all do these steps.....

1. Create a facebook page. i.e-facebook.com/abc.

2. After that create a apps in facebook which post our node to facebook page. www.developer.facebook.com. And create an apps. ie:- test and configure it looks like that...



3. After that we also configure it


4. Then save it.

5. Install fbautopost module and enable it. Install from http://drupal.org/project/fb_autopost
and configure it goto-mysite.com/admin/structure/fb
and goto stream post tab and create  Facebook's Graph Explorer token and fill text box save it.

6. And create content any and enable post on facebook and give its page name and save it. That post it on facebook page .if no any mistake.

After that enjoy it.

Tuesday, January 22, 2013

How to create Mega Photo gallery in Drupal 7

If you want to create mega Photo gallery in drupal 7 looks like below....

then follow some simple steps ..

1. First off all create a content type Gallery.

2. And add a image field configure it Number of value : Unlimited

3. Save it and add some content in Gallery content type.

4.  Add this line to default theme`s template.php

function bartik_process_page(&$variables) {
drupal_add_js(drupal_get_path('theme', 'bartik') . '/js/jquery.mousewheel-3.0.6.pack.js');
drupal_add_js(drupal_get_path('theme', 'bartik') . '/js/fancybox/jquery.fancybox.pack.js');
drupal_add_css(drupal_get_path('theme', 'bartik') . '/js/fancybox/jquery.fancybox.css');
$fancybox = "jQuery(document).ready(function() {
    jQuery('.fancybox').fancybox();
});";
drupal_add_js($fancybox, 'inline');
}

If this function already present in templete.php, then only add this line in between this function.


drupal_add_js(drupal_get_path('theme', 'bartik') . '/js/jquery.mousewheel-3.0.6.pack.js');
drupal_add_js(drupal_get_path('theme', 'bartik') . '/js/fancybox/jquery.fancybox.pack.js');
drupal_add_css(drupal_get_path('theme', 'bartik') . '/js/fancybox/jquery.fancybox.css');
$fancybox = "jQuery(document).ready(function() {
    jQuery('.fancybox').fancybox();
});";
drupal_add_js($fancybox, 'inline');


5. After that add custom template in template folder.Just like node--gallery.tpl.php
In this file that code are....


<div id="node-<?php print $node->nid; ?>" class="node-gallery">
<?php print render($title_prefix); ?>
  <?php if (!$page): ?>
    <h2  style="text-align:center;" <?php print $title_attributes; ?>>
      <?php print $title; ?>
    </h2>
  <?php endif; ?>
  <?php print render($title_suffix); ?>
    <?php
        $imgcount = count($node->field_image['und']);
        for ($i = 0; $i < $imgcount; $i++) {
        $image_uri = $node->field_image['und'][$i]['uri'];
            // url
            $masthead_raw = image_style_url('gallery', $image_uri);
    ?>
      <a href="<?php print file_create_url($node->field_image['und'][$i]['uri']); ?>" rel="group-<?php print $node->nid; ?>" class="fancybox">
        <img class="image<?php print ($i + 1);?>" src="<?php print $masthead_raw; ?>" />
      </a>
    <?php } ?>
</div>


6. Add a view its name gallery.


After that look my gallery its looks like...



Thursday, April 19, 2012

30+ Essential Drupal Modules

The Big Three

"The big three" are important enough that they deserve a category of their own. Most drupal modules worth using have integrated with one of these three. Their importance simply can't be stressed enough.

  • Content Construction Kit (CCK) - Part of drupal 7; still a contrib in drupal 6. Allows you to define new content types (e.g. blog entry, event, or employee record...) and add "fields" to them. A field could be plain text, an image, a flash video, or whatever. You can also adjust how these fields display in the live view. No drupal install should be without this module.
  • Views - Broadly speaking, this module empowers non programmers to build dynamic streams of content displaying any number of fields. The content may come from nodes (a.k.a. content types and fields), users, system log entries, etc. You can display this stream in any number of formats including RSS feeds, tables, or just the vanilla view for a content type. You can also create pages or blocks -- its very tightly interwoven with drupal. Nearly every drupal module worth using is integrated with this module. Extremely powerful when used in combination with CCK.
  • Panels -

    I believe Panels + CCK & Views is a hint at what drupal will look like 3 years into the future. I had to change my pants after the first time I witnessed it. At a very simple level, you could think of it as a layout manager. Create a 1,2,3 column layout. Or a 3 column layout with a full width footer and header, and plop pieces of content in them -- say a view, a block, or a node. That description, however does not do it justice. Since version 3, its positioned itself as a replacement for drupal core's clunky block system. It can now override a node page, and can be used to place content all over the place. It also introduced a concept of contexts, selections rules, and relationships. These are concepts that deserve a series of blog posts, but lets just say its solving some of the weirdest, mind numbing, bug creating problems found in advanced websites. Ironically, I used to hate this module, but after version 3 I will defend its awesomeness to the death!

For Administration Sanity

  • Admin Menu - Quick Dropdown menu to all admin areas. Makes any setting only a click away, instead of 3 to 6 clicks away.
  • RootCandy - A theme specially designed for administration. Drupal 7 comes with an admin theme included, but this is still highly recommended in drupal 6.

Content and SEO

  • Pathauto - Automatically create human readable URLS from tokens. A token is a piece of data from content, say the author's username, or the content's title. So if you set up a blog entry to use tokens like [author-name]/[title] then a blog entry by "Phil Withersppon" titled "my great day" will be rewritten example.com/phil-witherspoon/my-great-day.
  • Printer, email, and PDF Versions - There are still people out there who prefer to print out content to read later. This module does just that, and also lets them send your content via email.
  • NodeWords - A very poorly named module that's great at letting you edit meta tags.
  • Page Title - Lets you set an alternative title for the tags and for the

    tags on a node.
  • Global Redirect - Enforces numerous well thought out SEO rules, for example since I don't use this module you could access my content at "http://www.nicklewis.org/node/1062". This module however will search for the alias and 301 to the proper URL http://www.nicklewis.org/40-essential-drupal-6-modules. (thanks Jeff!)
  • Path Redirect - Simple idea: make it easy to redirect from one path to another. Does a good job at it.
  • Taxonomy manager - Makes large additions, or changes to taxonomy really really easy and painless.
  • Node Import - Made it shockingly easy to import 2000 csv rows, tie rows to CCK fields (or locations), and even will file it under the right taxonomy terms in hierarchy so long as you plan ahead.

Navigation

  • Menu Block - Lets you split menus into separate blocks based on depth. Say you have a top level menu link "Articles" with sub menu links "Politics", "Technology", "lifestyle". This block would let you show the sub menus in the right sidebar, and the top level "article" as tabs in the header.
  • Taxonomy Menu - Automatically generate menu items for categories. Handles syncing between taxonomy and menus, and is ready to be used in conjunction with views or panels.
  • Custom Breadcrumbs - Set up custom breadcrumb paths for content so that every page doesn't just have a breadcrumb back to "home". (note: i've used menu_trails a lot too.)
  • Nice Menus - Drop down menus (for people who are into that kind of thing).

WYSIWYG Editors + Image Uploading

  • WYSIWYG API - The standard integration module.
  • CKEditor - Currently my favorite WYSIWYG editor. WYSIWYG API only supports CKEditor on its dev version (at the time of this writing). For the time being, I use this module instead of WYSIWYG api. Regardless, the rest of the world probably uses WYSIWYG api.
  • IMCE - File browser / image inclusion for WYSIWYG editors. CKeditor is integrated out of the box, WYSIWYG API implementations require a bridge module.

Video and Image Handling

  • Filefield - Base CCK file upload field. Useful on its own, but also required by other essential modules.
  • ImageAPI, ImageCache, Imagefield - These three work together. ImageAPI handles low level integration with server side image processing (e.g ImageMagick). ImageCache allows you to set up presets for automatic resizing, cropping, and a host of other operations you'll probably never need to use. ImageField then provides an upload field to a piece of content, which you can use imagecache presets to resize in the display. Imagefield is very well integrated with Views and CCK. The paintings on the right show a bunch of images automatically resized using this technique.
  • Lightbox2 - If you've set up your imagefields, lightbox2 lets you add another layer of options. For example, display image resized at 300px wide on the page, but blow it up to full size when clicked. Like Imagefield, lightbox 2 is well integrated with Views and CCK. Very powerful combination.
  • Embedded Media Field - Embed video and audio files from dozens of third party providers ranging from youtube, to services you've probably never heard of.

User Profile, Ratings & Notifications

  • Content Profile - The core profile module sort of sucks. This turns profiles into nodes allowing you all the options of views and CCK.
  • Voting API + Fivestar - The standard voting widget of Drupal.
  • Notifications - Provides the ability to send emails when someone comments, or replies to a comment. Has a host of other features.
  • Captcha + Recaptcha - Standard Antispam system. In use on this very site.

Stuff Marketers Will Love

  • Webform - We all know visitors love filling out forms. This module lets your marketing team create custom forms, and collect whatever info they want.
  • Google Analytics - Simple integration of drupal with google Analytics.
  • Service Links - Easy "share this" links for content. Supports digg, facebook, delicous and a bunch of other social web 2.0 services.

Events and Calendars

  • Date - CCK field for handling dates, and date ranges.
  • Calendar - Integrated and controlled by views.

Location and Mapping

  • Location - Standard API for collecting addresses and lat/long. Integrated with Views and CCK. Somewhat difficult to use, but its a somewhat difficult problem it solves.
  • Gmap - Display locations in GMap.

Ecommerce

For Developers

  • Devel - Offers an enormous amount of information for developers, including: theme template variables, and overrides, browsable data structures, and datasets for performance-tuning. Just the debug function dsm(); makes it worth the download.
  • Backup & Migrate -- Greatly eases the pain of moving changes from your local development environment to the live server and vice versa.
  • Drush - Its actually not really module, but a "Swiss army knife" set of tools that are run from a command line. One example command is "drush dl views": running it will automatically download the latest version of views and place it in the right drupal folder. 1 second command instead of a 1 minute process of downloading from drupal, uploading via FTP. There's many other commands that are just as useful.

Conlusion

Lists like this can be outdated within six months. Always be on the look out for better and better modules.

Friday, March 30, 2012

Custom Search Module for Drupal



The Drupal core provides a Search module which is great for many sites. However, it doesn't provide some of the more sophisticated features that some sites need. The Custom Search module is a good alternative if you want more control over what gets searched, who gets to search, and what results you see.

The Custom Search module adds layers of control and sophistication to the core search module. It's easy to install and understand, and will give you more control over the search functions on your site. It also integrates with other search modules and APIs.



The core search function and the Custom Search module


tutuploadsmedia_1332978557735.png



The basic elements of the core search module are:

  • A block for front-end display. There is very little configuration available for this block. I've named this one "Core Search Block" to make it easy to distinguish from the customized one We'll be creating.

  • Advanced search is available on search results page. If a user clicks Advanced Search on the results page, a form opens up so you can refine your search. (When using the Garland Template).


This gives you a sophisticated search, but little control over how it's implemented throughout the site. A good way to expand on this is to add the Custom Search Module. Here's a summary of the added options.

Basic options:

  • Select which content type(s) to search,

  • Select which specific module search to use (node, help, user or any module that implements search),

  • advanced criteria


Advanced options:

  • change the default search box label,

  • add a default text in the search box,

  • add advanced search criteria,

  • change the default submit button text,

  • use an image instead of the submit button,

  • change the order of all the elements,

  • include some elements in a popup block,

  • add a filter to the results page,

  • show/hide basic and/or advanced search in the results page,

  • show/hide meta data in the results page,

  • multiple search paths





Step 1. Download and install the module







Step 2. Enable the module and its sub-modules


tutuploadsmedia_1332974776069.png



There are three included sub-modules:

  • Custom Search Taxonomy: taxonomy options for the search block.

  • Custom Search Blocks: provides additional search blocks, with different settings.

  • Custom Search Internationalization.





Step 3. Set Permissions for users and administrators


tutuploadsmedia_1332974833304.png



  • The confirmation message will have a link to the permissions. Click it to go directly to the permission settings.





tutuploadsmedia_1332975091365.png



  • Set user and admin permissions for two modules. I wanted everyone to be able to search so I gave anonymous users and authenticated users permissions by checking the boxes

  • You have four sets of permissions to set.

    • Custom Search

      • Admin

      • User



    • Custom Search Blocks

      • Admin

      • User









Step 4. Configure the module


tutuploadsmedia_1332975243521.png



  • Return to the Modules page and click Configure. You can also get to the configuration screen by going to Configure > Custom Search








tutuploadsmedia_1332975841984.png



  • When you land on the configuration page the selected tab will be highlighted. You will be going through all the tabs to complete the full configuration. So when you complete the first page, choose another tab and continue

  • I'm not going to go through every single configuration step. The choices are easy. If you have a need to create refined searches, they will make sense to you. If not, trial and error is the best way to get familiar with them. In this demo I'm going to enable everything.

  • There is one section that may need a little explanation - the Search Blocks tab:





tutuploadsmedia_1332981680985.png



  • Select the number of blocks. One of the great things about this module is that every block can have it's own configuration settings. Suppose you wanted a block on the home page that searched the entire site, but not the forum. On the forum page you want a block that only searches the forum. In that case you would create two blocks. If you wanted anonymous users to be able to search just some forum topics, and registered users to have more option, you would create 3 blocks, and control which one shows by who's logged in.

  • I'm just going to create one for this demo. Once you decide on this, add blocks to your site.

  • Be sure to save before moving on.





Step 5. Add blocks to your site


tutuploadsmedia_1332982028297.png



  • Go to Structure > Blocks.





Step 6. Assign blocks to regions


tutuploadsmedia_1332976654551.png



  • The custom search blocks you created will be visible and numbered.

  • Choose the regions for the blocks.





tutuploadsmedia_1332982219714.png



  • The new block is added.

  • The original block created by the core is still there. It's default label is Search Form. I can't think of a reason why you would want both of them on the same page unless you're writing a tutorial, so you can remove the original if you want.

  • Be sure to Save Blocks before you try any configuration.





Step 7. Customize the blocks from the front end


tutuploadsmedia_1332982785885.png



Here are both blocks, the original core search block and the one I just added. Compare the look of the Core one with the first image. You'll see that some custom features have been added. The first picture just shows an entry field and a search button. Now we can search tags and forums. This is because the new module makes those capabilities available to all the modules.

It also makes customization very simple. When you are viewing the module from the front end, mouse over the title and you will see an icon that looks like a cog from a gear.




tutuploadsmedia_1332983164241.png



This will give you access to the configuration for this particular module. It makes it much simpler if you are going to have multiple search boxes with different types of search. You can define each one while you are on it's page. It saves time and prevents mistakes.




Step 8. Configure Visibility


tutuploadsmedia_1332983345582.png



  • Clicking Configure will allow you to change the visibility and normal block function.





tutuploadsmedia_1332977044916.png



  • Clicking Custom Search configuration will give you access to define the search box itself.





Step 9. Configure each block to have custom features


tutuploadsmedia_1332983579145.png



From here you can configure what's include and what type of search you want.




Result


tutuploadsmedia_1332983702278.png



Above you can see what the original search block looks like after I've configured some additional elements to show. This will allow you to present a highly customized search experience to your the public and authorized users.


Multiple Categories with the Drupal Contact Module

The Drupal Contact module is often replaced by the Webform module. However, it can be useful in some situations. For example, image that you have different departments and you want each of them to get a different contact form on your Drupal website. If you're willing to keep it simple, you can do everything you need with the core Contact module and won't have to install anything else.



It all depends on knowing how to create categories and blocks.



Step 1. Make sure the Contact module is enabled


tutuploadstutuploadsStep_1._Make_sure_the_Contact_module_is_enabled.png



  1. Click Modules

  2. Click Save configuration.

  3. Click Configure next to Contact.





Step 2. Add and edit categories.


tutuploadstutuploadsStep_2._Add_and_edit_categories..png



Click Add category to add a new one.

There is a default category called Website feedback that you can use as well, but we are showing you how to add extra ones. You can edit the default category later if you need to.




Step 3. Configure the category


tutuploadstutuploadsStep_3._Configure_the_category..png



  1. Give the category a name.

  2. Specify the Recipients

  3. Create an Auto-reply message.

  4. Set Selected. Yes means it will be the default contact form. Since this is a new category, you probably want this to be No. You can only have one default.*

  5. Be sure to click the Save button.


*Selected: When a visitor clicks on the link to the contact form, the categories will show in a drop down list. Whichever one is chosen with a "Yes" will show automatically If you want your visitor to be forced to choose a category before submitting the form, make all of these fields "No"

Continue repeating the process until you have all the categories you want. A "category" can be a different department, a group or individual.




Step 4. Enable the menu link


tutuploadstutuploadsStep_4._Enable_the_menu_link..png



Jump to the Menus administration page by clicking the blue link in the instruction paragraph. Alternatively you can get their via the admin menu and clicking Structure then Menus.




tutuploadstutuploadsAlternate_path_to_Menus.png



Step 5. List the links


tutuploadstutuploadsStep5._List_the_links.png



A Contact menu item (disabled by default) is added to the Navigation menu, which you can modify on the Menus administration page. Click list links next to Navigation.




Step 6. Enable the link


tutuploadstutuploadsStep_6._Enable_the_link.png



This menu link will go directly to the site-wide contact form. You will see a Contact menu item that is disabled. You can use this one as a guide for creating other menu links.




Step 7. Configure the link


tutuploadstutuploadsStep_7._Configure_the_link.png



  1. Edit the link title if needed.

  2. Enable the link so it appears on the menu.

  3. Choose the parent link if you want it to be different from the default "Navigation".





Step 8. Add a block with instructions for the user


tutuploadstutuploadsStep_8._Add_a_block_with_instructions_for_the_user.png



Go to Structure > Blocks.




Step 9. Add a block


tutuploadstutuploadsStep_9._Add_a_block..png



Step 10. Add the block information


tutuploadstutuploadsStep_10._Add_the_block_information..png



  1. Enter a Block Description. This will not be seen by the public.

  2. Enter a Block Title. This will be seen by the public.

  3. Write your instructions. This will also be visible to the public,


Scroll down the page.




Step 11. Set the visibility settings by assigning it to the Contacts page


tutuploadstutuploadsStep_11._Set_the_visibility_settings_by_assigning_it_to_t.png



  1. Choose "Only listed pages". The only page we want to have these instructions is the Contact page.

  2. Write "contact" in the text field.

  3. Save the block.


Specify pages by using their paths. Enter one path per line. The '*' character is a wild card. Example paths are blog for the blog page and blog/* for every personal blog.is the front page.

There are other parameters and settings on this page, but for the purpose of this tutorial we only need the basics.




Step 12. Enable the block


tutuploadstutuploadsStep_12._Enable_the_block.png



You will be returned to the Blocks page. You will find the block you added in the Disabled list with the title you created. To enable it, choose the position from the drop down box.




tutuploadstutuploadsmedia_1318376672850.png



Choose Help.

This box lists all of the regions available on the template you are using. On the Bartik template, the Help region is right where we want it. You may have a different idea or location on your website.




Step 13. Final configuration then save.


tutuploadstutuploadsStep_13._Final_configuration_then_save..png



As soon as you choose the region, the block title will now be visible at the top of the page that shows the enabled modules. The will be grouped by region, so this one will be under Help.

Remember to Save - scroll to the bottom of the page




tutuploadstutuploadsmedia_1318376971177.png



No changes will be saved until you click Save blocks.




Your result


tutuploadstutuploadsYour_result.png



If you followed all these steps you will have a contact form that looks something like this.

  1. There is a link on the menu to the form.

  2. The instructions are in the Help Region in a block you added.

  3. The correct email address shows. (this will change to the right one when the category is selected).

  4. There is a drop down list with the categories you created.




A Introduction to the Drupal 7 Media Module




The Media Module is one of the most hyped new modules for Drupal 7. It is often talked about as the best option for handling images, video and audio files in Drupal 7.

However, available information about the Media Module is long on 90 minute conference presentations and short on quick, practical guides. So, in this tutorial we're going to get right to the point. We're going show you how to set up the Media Module, what it does and how to use it to add YouTube videos to your content. Let's go ....



Install the Media Module




Head over to http://drupal.org/project/media and download the Media Module. You will also need the latest version of the CTools module from http://drupal.org/project/ctools.




tutuploadsmedia_1329323257702.png



Understand the Media Module




Go to Structure > Content types > click Manage fields next to a content type.

You'll see that a new field option called "Multimedia asset" is now available.




tutuploadstutuploadsmedia_1329321089490.png



This field type will allow you to upload a variety of file types. Click Save and you can decide that those file types are:




tutuploadstutuploadsmedia_1329321123983.png



If you create a "Multimedia asset" field for you content, the image below shows what it will look like when you go to add content.




tutuploadstutuploadsmedia_1329321160323.png



Click on "Select media" and you can upload new files.




tutuploadstutuploadsmedia_1329321181758.png



Most importantly, you can also browse a Library of all the files that you've uploaded.




tutuploadstutuploadsmedia_1329321446684.png



This Library feature is the real reason for using Media. As explained on the Media FAQ page: http://groups.drupal.org/node/19746

"The Media module provides an engine that can be used to manage files and metadata. Individual Media module plugins, as well as the modules they integrate with, will handle media display."

So the only thing this field can do at the moment is upload files to the library. If you want to actually show the files, you'll need to rely on extra modules. Let's see how that works.

Go to Structure > Content types > click Manage fields next to a content type. If you choose to add a File field you'll now have a Media file selector option.




tutuploadstutuploadsmedia_1329321575868.png



If you choose to add a Image field you'll now have a Media file selector option.




tutuploadstutuploadsmedia_1329321599641.png



Here's what the Image field will look like when you go to add content.




tutuploadstutuploadsmedia_1329321692781.png



You'll be able to browse your new media library and insert an image just as you would do normally.




tutuploadstutuploadsmedia_1329322313974.png



Adding Video to Content via the Media Module




Adding external videos to the Media module relies on the Embedded Media Field module: http://drupal.org/project/emfield.

That module allows you to hook into all sorts of external sites, provided you have the appropriate module. In this example, we'll use YouTube so install this module as well: http://drupal.org/project/media_youtube.

Install and enable both of those modules.




tutuploadsmedia_1329324509632.png



Go to Structure > Content types and add a Multimedia asset field.




tutuploadsmedia_1329324555689.png



As you choose the settings, make sure to check both the Video and youtube boxes.




tutuploadsmedia_1329324583650.png



Save that new field.

There is one important thing you must now do to make sure that the videos display. Click on Manage Display at the top of the page.




tutuploadsmedia_1329328094802.png



Normally settings for the video field would be available but in this case I had to click Save before they appeared. Then you can click the cog on the right-hand side, next to the video field.




tutuploadsmedia_1329327802623.png



Set the File view mode to Small, Large or Original and click Update.




tutuploadsmedia_1329328239375.png



Click Save so that your changes aren't lost.

Now you can go to Add content and use the new video field.




tutuploadsmedia_1329324699175.png



Once you've inserted the YouTube URL and clicked Submit, you should see a video thumbnail as in the image below.




tutuploadsmedia_1329324715341.png



Save the content and your video will be showing on the page.




tutuploadsmedia_1329328419096.png



YouTube is a simple and popular example. If you want to use other sources for video or audio, head to http://drupal.org/project/emfield and you'll see a list of all the options and the modules that they require.

 

A note of caution: Media is under heavy development. There isn't yet a stable version of Media. As of mid-February, there is a Release Candidate 3 but not yet a stable version.