6 special howtos for drupal

31
EXTENDING FUNCTIONALITY IN DRUPAL Wilson Wingston Sharon [email protected]

Upload: wingston

Post on 09-May-2015

4.975 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: 6 Special Howtos for Drupal

EXTENDING FUNCTIONALITY

IN DRUPAL

Wilson Wingston Sharon

[email protected]

Page 2: 6 Special Howtos for Drupal

What else you’ve got?

Custom front pages. CAPTCHA support. Galleries of content. Javascript with jqueries. More display control with panels. More useful modules

Page 3: 6 Special Howtos for Drupal

Front_page module

Allows you to specify a custom front page based on role type.e.g. For a musicians website, you could have a

different front page for Drummers, Guitarists, Singers, Bass Players etc.

Allows you to have a FULL front page or FLASH SPLASH page – in a completely different layout from your main drupal site

Page 4: 6 Special Howtos for Drupal

CAPTCHA by mollom Spam control

Install the mollom module and enable it.

Go to mollom.com and register your site.Get the public and private keys after

registration.

Enter these keys in administer>>site cofig>> mollom

Page 5: 6 Special Howtos for Drupal

Mollom.com

Now set the fields that you want mollom spam control to enable.

Remember this adds a small overhead wherever you use it.

Use it only for user registration and user password request forms.

Page 6: 6 Special Howtos for Drupal

Image galleries

Best option is to create a custom image type using CCK with an imagefield module [drupalmodules.org]

Use taxonomy to tag and organise your images.

Use views to display the images.

Page 7: 6 Special Howtos for Drupal

Image galleries – more info Use these modules.

CCK + imagefieldImage cacheViews + views bonus packCustom Pagers

○ allows administrators to define context-sensitive previous/next pagers for any node type.

Lightbox or thickbox

Page 8: 6 Special Howtos for Drupal

Image gallery – howto 1 After installing modules

Go to image cache admin pages and create image presets. 'Square Thumbnail' – scale to 150 x 150 then crop to 75 x 75 'Display' – scale to 650 x 650

Go to administer content types and create a content type for images. Add an image field type to it.

Go to taxonomy and create a vocabulary and taxonomy to sort your images. Make it required to choose at least one term for your image content type.

Page 9: 6 Special Howtos for Drupal

Image gallery – howto 2 Go to views and admin>>build>>views

In page settings choose bonus – grid view

In fields section add the title and image fields of your image content type.

On the image field choose 'Do not group multiple values' for 'Handler‘ chose the Imagecache preset size that you want to use for

your gallery images in the 'Option' section. If you installed the Thickbox module, you should see an

option called 'Thickbox: Square_Thumbnail

Page 10: 6 Special Howtos for Drupal

Image gallery – howto 3 In the Filters section choose

Node Published = YesYou can also filter by taxonomy here to show

images with a particular term. If you wish.Choose taxonomy term and give required settings.you can create one gallery view and 'expose' the

taxonomy filter [button on side] so people can choose what gallery to look at.

Check use AJAX in basic settings for changes w/o page reload.

Page 11: 6 Special Howtos for Drupal

Image gallery – final tweaks So at this point, if you have created some CCK

image nodes, you should see a gallery at the page you’ve created. Give it a name and a menu block and check it out. Remember to save first though.

Go into administer>>'Custom pagers' Click 'Add a new custom pager'. Most of the settings

will be obvious, but these are two key ones:Node Type = Image (or again whatever you called you

CCK image content type) In the "Use a view" section, pick the name of your

gallery view.

Page 12: 6 Special Howtos for Drupal

SWF tools SWF Tools allows you to easily embed flash

content on your pages. use CCK filefields.or use an input filter with [swf

file="mymovie.swf"]or use PHP and call print swf('mymovie.swf');[swf file="myAudio.mp3"] or [swf

file="myVideo.flv"]. Will create a video player automatically..

Remember to go to admnister>>input formats and enable swftools there.

Page 13: 6 Special Howtos for Drupal

Jquery In versions prior to Drupal 5.0, javascript

effects are made possible through a decent library of functions in /misc/drupal.js.

One limitation of drupal.js was the fact that its development would never match the pace of dedicated javascript libraries.

The AJAX developers group began looking for agreement about which library should be used.

jQuery was identified as the best candidate. Its also under GPL and bundeled with drupal.

Page 14: 6 Special Howtos for Drupal

Benefits of jquery

The core jQuery library is very small (about 15kb).

jQuery has a clean, modular approach to plugins.

The core library is stable, being in perpetual feature freeze from version 1.0.

Page 15: 6 Special Howtos for Drupal

Jquery – javascript teqniques

<?php

drupal_add_js (

'$(document).ready(function(){$("p.jtest").fadeIn(6000);}); ',

'inline');

?>

<p class="jtest" style=“width: 30em;display:none;">

This is an example of an effect which is built into the core jQuery

library. This text should fade in after the DOM is loaded. <a

href="http://api.drupal.org/api/HEAD/function/drupal_add_js">

drupal_add_js()</a> was used to add the <a href="http://jquery.com/api/"> fadeIn</a> effect to any paragraph with the class <b>jtest</b>.

</p>

Add this content to a page with the php input filter turned on.

Page 16: 6 Special Howtos for Drupal

Panels The Panels module allows a site administrator

to create customized layouts for multiple uses.

it is a drag and drop content manager that lets you visually design a layout and place content within that layout.

Integration with other systems allows you to customize the layout of your site with very fine grained permissions

Page 17: 6 Special Howtos for Drupal

Panels && more views

Install the panels and the ctools module.

Go to administer>>views. Under default view list, find front page and archive views and click on enable for both of them.

Go to administer>>panels. Then to settings/panel pages..Check everything in new content behaviour.

Page 18: 6 Special Howtos for Drupal

Panels - 1

Go to dashboard in administer>>panels. Create new panel page.

Admin title – HomePath to frontCheck make home page.Click continue.

Choose flexible layout.

Page 19: 6 Special Howtos for Drupal

Panels 2 – the design

Click show layout designer. Click on the lowermost region, change

name from center to “Left”. Now, click on rows, just above it and

select add region to right. Name it “Right”.

Move the slider bar to give a 80/20 shift. Click finish.

Page 20: 6 Special Howtos for Drupal

Panels 3 – …

Click on the menu tab on the left. Normal menu tab.Set the Weight to: -10 Title to 'Home'.

Click update and save.

Page 21: 6 Special Howtos for Drupal

Panels 3 – adding content

Now go to the content tab.Click on gear icon in left pane and choose

add content.Choose views, frontpage [created earlier]

and choose page.Check 'Link title to view'.Check 'Provide a "more" link that links to the

view'. Click 'Finish' at the bottom.Update and save.

Page 22: 6 Special Howtos for Drupal

Panels 4 – more and more On the right pane, click gear icon under activity select who’s new. Click on gear again and select who’s online

under activity. Click on gear again and select archives

under views. Use block display.Link title to view and click finish.

Click finish and save. Check your front page out. Disable all blocks on frontpage.

Page 23: 6 Special Howtos for Drupal

Robots.txt

Check robots.txt in your drupal root. When using pathatuo, add following line

Disallow: /node/ Else, search engines will discover

duplicate over a period of time, and some users have reported a penalization for duplicate content. However, Google states that there is no penalty.

Page 24: 6 Special Howtos for Drupal

Gmap location module

Using a google maps module to acces the gmaps API.

Get the free google maps api key. [google it]

Creates a single Google Maps page (at http://yoursite.com/gmaplocation), designed to display one location for the site, with an address marker.* The map location is automatically geocoded from a street address.

Page 25: 6 Special Howtos for Drupal

Community – social networking

Organic groups module allows you to create “groups” and assign users to choose a particular group.

users post content with visibility restricted to their group, a kind of private group chat or discussion.

A group has its own administrator & users can subscribe to a group or be invited to join group.

OG module has many ancilliary modules that will allow multiple abilities on your website.

Page 26: 6 Special Howtos for Drupal

Other modules for Social n/w Blocks for OG Private Forums for OG Activity Buddy list – lets your users have

friends.. Friend module User invite User relationships

Page 27: 6 Special Howtos for Drupal

Facebook connect (!beta) This module allows users to login on a Drupal

website through the Facebook Connect API – using their Facebook login and password.

The module also brings other extra features:Users can see which of their Facebook friends already

have an account on the Drupal websiteUsers can publish a customizable message on their

Facebook feed announcing that they have created an account on the Drupal website

Users can invite their Facebook friends to create an account on the Drupal website

Page 28: 6 Special Howtos for Drupal

To use facebook connect Download the Facebook PHP libraries from

http://svn.facebook.com/svnroot/platform/clients/packages/facebook-platform.tar.gz.

Copy the content of the "php" folder into the "facebook-client" folder,

Create a new application on fb: name it your site’s name http://www.facebook.com/developers/createapp.php

Configure the module through the 'Fbconnect' section of the 'Site configuration' menu,

use the information provided by Facebook (API key, Secret API key).

When editing configuration, make sure your facebook session's is active

Page 29: 6 Special Howtos for Drupal

WSIWYG editor

http://drupal.org/project/wysiwyg WSIWYG is in alpha now. It should be in beta in a couple of weeks. Wysiwyg module allows you to use

client-side editors (a.k.a. WYSIWYG editors) to edit content in Drupal. It simplifies installation and integration of editors and allows to assign an editor to each input format.

Page 30: 6 Special Howtos for Drupal

Ubercart for commerce solutions Ubercart is an e-commerce suite

developed for Drupal. It has been designed with the end user

in mind, focusing on usability in three key areas: store configuration, product and catalog creationorder administration.

Page 31: 6 Special Howtos for Drupal

Backup and migrate module

Allows you to take periodic backups of your SQL database only.

It will retrieve your SQL database.

You can use it to migrate site from a test installation to a live one.