Friday, December 28, 2012

Accessible “Read More” Links

When there are a bunch of “read more” links on a page, it is usually fairly obvious from visual cues what the “read more” refers to. However, when screen reader users encounter a bunch of “read more” links on a page, it is not always obvious which part of the page each “read more” link refers to. A simple solution is to use a bit more descriptive text than simply “read more” and use CSS to hide the additional text. In this example the following code is used.

<p><a href="#">Read more <span class="offscreen">About NC State</span></a></p>
 
This is the CSS rule.

.offscreen {
position:absolute;
left:-999px;
width:1px;
height:1px;
top:auto;
}
 
Notes:
  • The off-screen text needs to be included in the <a> as well, otherwise it won’t be read correctly by screen readers.
  • You cannot use the CSS rule display:none or visibility:hidden as that will make the content invisible to screen reader users.
  • This code is not unique to me. It is the compilation of different examples I have seen in various accessibility forum posts. I just want to put this example in writing for others.

Thursday, December 13, 2012

Autocomplete off - (Custom Module)

'Autocomplete off' Module work on these forms - user login, user profile, user_register, user_pass.

Download Module

Form Autocomplete off

function autocomplete_form_user_login_alter(&$form, &$form_state) {
$form['#attributes']['autocomplete'] = 'off';
}

Monday, December 10, 2012

Clear cache URL or menu link

Create a new page, with the input filter set to a filter that can run PHP. Then use the following snippet, which was shamelessly yanked from devel.module:
<?php/*
* 2008 Jun 26
*
* The code submitted by dharmanerd in his comment probably
* works better than the original I had, so I've modified this
* to match his code.
*
* The original code for this was shamelessly yanked from
* `devel.module`; it was the function `devel_cache_clear()`.
*
*/

// only allow site administrators to visit this page:
if (!user_access('administer site configuration')) {
 
drupal_not_found();
}
else {
 
drupal_clear_css_cache();
 
$tables = array(
   
'cache',
   
'cache_content',
   
'cache_filter',
   
'cache_menu',
   
'cache_page',
   
'cache_views',
  );
  foreach (
$tables as $table) {
   
cache_clear_all('*', $table, TRUE);
  }
 
drupal_set_message('Cache cleared.');
 
drupal_goto();
}
?>
Set a URL path for this page (perhaps 'cache_clear') so that you can clear the cache easily. Clear the cache by visiting the URL or add the path to a menu link(watch your permissions).
Code Notes:
  • The drupal_goto at the end of the page will redirect you to either the destination or to the main page of your site; you can change this if you wish.
  • If this code is in a block that was visible on all pages (i.e. including the home page) then the home page would endlessly redirect to itself, breaking your site. The answer is to remove the drupal_goto() from the code, then all caches would be cleared on every page view.
  • Because of the drupal_goto, you can never actually visit this page; you can edit it through the admin/content/node page.
  • You may have to remove the path parameter to the function call drupal_goto, because it gets added to the homepage URL.
  • If you missed some part of the code, which makes the site inaccessible you can remove the code through phpmyadmin, by browsing the block table and editing the appropriate block you created.

Wednesday, November 28, 2012

API reference

Welcome to the Drupal 6 developer's documentation. Newcomers to Drupal development should read the conceptual information provided in the "Components of Drupal" section, and then proceed to examine one of the heavily-documented example modules below. The examples are fully-functioning Drupal modules, so you can download them from the contributions repository and alter them as you experiment.
Read More....

Sunday, November 25, 2012

11 Things About Drupal 7

(1) The default administrative theme is greatly improved.
In earlier versions of Drupal, the default administrative theme was a bit homely and hard for new, non-technical users to navigate.  There were a series of contributed modules for Drupal 6 you could install to improve the situation, but it was an extra step you had to take, and additional moving parts you have to deal with when updating.  Drupal now has a slick and user friendly administrative theme as part of core.  The administrative interface now includes Ajax goodness, an overall admin toolbar, shortcuts and generally increased loading times.
(2) Improved support for WYSWYG’s. 
In Drupal 6 you could enable WYSWYG functionality by installing external modules, but they never seemed to work quite right.  Drupal 7 makes the integration of WYSWYG editors more seamless.  The end result is that they work better.
(3) Drupal 7 loads faster.
A long time complaint about Drupal is that it makes a lot of database calls, causing high server load that lead to speed issues when serving un-cached pages.  Drupal 6 was a big improvement, but Drupal 7 features significantly less SQL queries causing sites to load faster.
(4) CCK is now part of core Drupal.
When working with Drupal 6, installing the Content Construction Kit (CCK) module was pretty much a requirement.  CCK has been moved into core and rebranded as the Field API.  Moving CCK into core gives developers the power to add fields to not only content types, but also to People, Taxonomy, etc.
(5) The image/file upload feature that is included in the Field API is invaluable.
Uploading files along with content in Drupal 6 was always a bit of a clunky process.  Getting it to function the way you wanted was always a battle.  In Drupal 7 what you can do right out of the box is much improved:
  • The Field API allows you to specify which file types you want to allow (JPG, GIF, PDF, DOC, etc.).  It also lets you set upload limits and maximum dimensions when uploading images.  
  • Files are now uploaded via an AJAX interface.  After the file is uploaded it is immediately displayed in the form, where the user sees the file name and can delete the file right there.  Further, as the file is uploaded the user sees a loading image so they can be confident that the file is getting loaded.
The end result is more flexibility for developers, and a better experience for administrators.  All of this was possible in Drupal 6, but it was a battle to get to the functionality you wanted.  The fact that these features are now integrated into the Field API will save developers a lot of headaches.
(6) There is more flexibility in what kind of content can be a custom content type.
In Drupal 6, content types were really designed to be text fields, with the Body field required for all custom content types you created.  In Drupal 7, this requirement has been removed.  This makes it less clunky to create non-text based custom content types for assets such as PDFs or images.
(7) Working with jQuery plugins is much easier in Drupal 7.
jQuery is probably the most popular JavaScript library, and allows for the rapid development of client side site features.     Drupal 7 has made it much easier in general to use jQuery in your themes, and also ships with a  jQuery 1.4.4, which  is much faster and more feature rich than jQuery 1.2.6, which was the default in Drupal 6.   For the front-end developers out there, this is a big improvement that will save lots of time.
(8) Drupal 7 uses PHP Data Objects (PDOs), which allows for developers to more easily write portable code.
By making this switch, Drupal 7 is no longer dependent on any specific type of database.  The result is greater flexibility.
(9) There are a lot more hooks, which allow for more customizations on a deeper level.
Hooks are what allow for the modules you write for Drupal to connect to Drupal core.  In Drupal 7, there are a lot more hooks and they have separated hooks that were used for multiple tasks into smaller pieces.  This makes Drupal 7 truly modular, and gives developers the ability to create deeper customizations.
(10) Drupal 7 is much easier to update.
Keeping Drupal 6 current was a hassle, as to update a module you had to download it, unpack it, upload it again and then run the update.  Drupal 7 features an Update manager that tells you when a module is out of date and allows you to update it right from the web interface.  Much, much easier, and more like the experience in WordPress.
(11) Blocks are much easier to configure.
In Drupal 6, to create a block you have to first create a block on the page you want it to appear, and then go to the slow-loading block overview page to set where on the page you want it to appear.  In Drupal 7 this is all done in one step.  While it sounds trivial, this can save a lot of time on more complicated sites.


Thursday, November 22, 2012

Sections - Module

This module allows you to create sections within your site. Each section has an installed template, theme or style attached to it.
Sections are shown based on:
  • Node specific visibility settings
  • Role specific visibility settings
  • Page specific visibility settings (regexped paths)
  • Custom PHP visibility snippets
Read More...

Solved Drupal Interview Questions


1.       How do I access the Drupal admin panel, when the login block is disabled?
Answer :- This is really a common question among Drupal beginners; we need not always want the login block to be displayed in our site. Since most of these cases the login block will be turned off in the administration. In those cases, we can access the login screen simply through the following URL.

http://sitename.com/?q=user
or if the clean URL is enabled

http://sitename.com/user
Similarly if you can’t access the logout link and need to logout, you can do so by using the URL

http://sitename.com/?q=logout
alternatively with clean URLs enabled you can try

http://sitename.com/logout


2.       What is the difference between Core and Contrib?
Answer:-  The standard release of Drupal, known as Drupal core, contains basic features common to content management systems. These include user account registration and maintenance, menu management, RSS-feeds, page layout customization, and system administration. The Drupal core installation can be used as a brochureware website, a single- or multi-user blog, an Internet forum, or a community website providing for user-generated content.
As of August 2011 there are more than 11,000 free community-contributed addons, known as contrib modules, available to alter and extend Drupal's core capabilities and add new features or customize Drupal's behavior and appearance. Because of this plug-in extensibility and modular design, Drupal is sometimes described as a content management framework.[3][8] Drupal is also described as a web application framework, as it meets the generally accepted feature requirements for such frameworks.
3.       How does caching work in Drupal?
Answer:- One of the common (mostly unfounded) complaints about Drupal has been, "Drupal is slow." You want to hire a developer who understands Drupal's built in caching system, and what its limitations are. For example, Drupal 6's block cache will not appreciably speed up the page if the user is logged in.
Ask your candidate to recommend some additional solutions to speed up Drupal's caching. These could include the Boost module, Varnish, Squid, Memcache or Pressflow. Ask if they've ever run into issues with Drupal's cache.
4.       How to make my Drupal site offline to public, while it is under construction?
Answer: - You can set your Drupal site in off-line mode, while it is being developed. Just click Administer » Site maintenance. There you can set the status to off-line. If you wants, you can also set your own custom off-line message. When set to Off-line, only users with the administer site configuration permission will be able to access your site to perform maintenance; all other visitors will see the site off-line message configured there. Authorized users can log in during Off-line mode directly via the user login page.
5.       How can I install a new theme in Drupal?
Answer:- This is another common question among Drupal newbies all time. After trying out all available themes under Drupals theme directory, we may naturally want to try new themes. Installing a new theme is very simple and straightforward. Follow the steps below.
 Download a new theme package. Note that themes for different Drupal versions are not compatible, version 5.x themes do not work with Drupal 6.x and reverse.
 Read any README or INSTALL files in the package to find out if there are any special steps needed for this theme.
Upload the contents of the theme package to a new directory in the themes directory in your Drupal site. In Drupal 5.x & 6.x, you place your themes in /sites/all/themes/yourThemeName
 Click administer » themes and enable the new theme (Drupal will auto-detect its presence).
 Edit your user preferences and select the new theme. If you want it to be the default theme for all users, check the default box in the themes administration page.
6.       How to install a new module in Drupal?
Answer:- After finding and downloading a module, the next step would be to copy it the modules folder. Most people copy the file to the default modules folder here http://sitename.com/drupal/modules this is where all the modules that ship with Drupal are stored so it seems somewhat logical to do this. But this folder is actually meant to store only Drupal’s default modules. Instead you should go to http://sitename.com/drupal/sites/all folder, there you will see a readme.txt file. This file will clearly tell you the trick. You just need to create a new folder named modules here. Now copy the modules folder here. That’s all, you have successfully installed the module.
Next step would be to enable the module through the Admin interface. To do this navigate to Administer » Site Building » Modules. Here you will see a list off all installed modules, and our newly installed module will also be listed here. You just have to check the enable check box against the new module and then click the Save Configuration button. That’s all.
7.       How can I reset my Drupal admin password
Answer:- In such a worst scenario, drupal admin password can easily be reset from the Drupal database. The Drupal database can be accessed through phpMyAdmin tool available with your web hosting account. Follow the below steps to get your drupal admin password reset quickly:
·         Login to cPanel -> Databases box -> phpMyAdmin;
·         Select the Druapl database folder from the left navigation bar. The page will refresh and and the Drupal database’s tables will be displayed on it.
·         Click on the SQL tab.
·         In the text field write the following SQL query:
update users set pass=md5(’NEWPASS’) where uid = 1; where “NEWPASS” is your new Drupal administrative password.
Click the GO button to submit the query. If the query is executed correctly and no errors are displayed then you should be able to login with the new password.
8.       How can I change the favicon in my Drupal Site?
Answer:- A favicon (short for favorites icon), also known as a website icon or bookmark icon is a 16×16 pixel square icon that appears near the address bar and in the bookmarks folder in a visitor’s browser. By default, a drupal site shows that water drop kinda drupal logo as favicon. If you want to make your site unique by all means, you can easily change the favicon to your customized icon by following the steps below.
·         Create your own favicon.ico file using any graphic tools or with the help of any online favicon generator tools like dnamicdrive.
·         Navigate to admin » site building » themes and click the configure link next to your current theme. This will bring up the theme configuration page.
·         Here you will see a section titled Shortcut icons settings. You can either upload your favicon file or specify the path to your customized icon file.
The changes may not appear immediately in your browser, you need to clear your browser’s cache and reload the page. If you have bookmarked your site, you may need to delete the bookmark and then recreate it again so that the new favicon will appear in the bookmarks menu.
9.       How can I enable clean URLs in Drupal?
Answer:- Drupal’s default URL structure is like “http://www.sitename.com/?q=node/10 This URL format can be hard to read, and can sometimes prevent search engines from indexing all your pages properly. In this case you can eliminate this “?q=” and clean the URLs through the following steps.
Navigate to Administer » Site configuration » Clean URLs. By default, it will be disabled. Select enabled and click the save configuration button. You are done.
You can make your URLs even more cleaner with the help of path module.
Home » Administer » Site building » Modules: enable the Path Module.
10.   How do I get my site to have SEO-friendly URLs?
Answer:- The Pathauto module automatically generates URL/path aliases for various kinds of content (nodes, taxonomy terms, users) without requiring the user to manually specify the path alias. This allows you to have URL aliases like /category/my-node-title instead of /node/123. The aliases are based upon a "pattern" system that uses tokens which the administrator can change
11.   How do I remove the title ‘Navigation’ from the navigation block?
Answer:- To prevent the navigation block title or any other block title from appearing in the pages, just do the following.
·         Navigate to Administer » Site building » Blocks and click the configure link next to the Navigation block.
·         In the block configuration page, enter <none> in the Block title filed. This will override the default title for the block and remove the title.
12.   How can I translate Drupal to my local language
Answer:- The interface text (like the “Log in” button and the “Add new comment” text) is in English by default, but can be translated. For many languages, there are completed or partly completed translations available. (See the locale module on how to use them.)
All languages need more translation contributions. Some have only incomplete versions of the text in core, so that parts of the interface will show up in English. Others may be complete but need corrections and improvements of the language. And no language has a complete set of translations for all contributed modules
13.   How do I add images to Drupal?
Answer:- Image module allows users with proper permissions to upload images into Drupal. Thumbnails and additional sizes are created automatically.
Images could be posted individually to the front page, included in stories or grouped in galleries.
14.   How do I show different Drupal themes on different pages?
Answer:- Yeah it’s possible! You can apply different themes to different pages in your drupal site simply with the help of a cool module called ‘Sections’.
15.   How do you handle upgrades?
Answer:- It's a fact of life that you'll have to upgrade your Drupal installation and contributed modules fairly frequently. Your candidate should mention:
·         backing up the site,
·         putting it into maintenance mode
·         downloading the new version of the module
·         uncompressing it
·         running update.php
·         testing the site
·         taking the site out of maintenance mode
Ideally, your candidate would also mention creating a development environment to minimize downtime. There is also a big difference between upgrading a module (process described above) and a Drupal minor version upgrade, which requires more careful patching. Drupal major version upgrades, which happen every couple years, are another can of worms entirely.
16.   How can I customize my 404 – Page not found page?
Answer:- Create a new page with some extra information, so that your visitors don’t ever plunge on to the default boring 404 – page not found error page.
Once this page is created:
·         Remember its node ID,
·         Go to Administer > Site configuration > Error reporting
·         Set Default 404 (not found) page to the node ID you just created
·         Save your settings
You can also use the Search 404 module as an alternative.
17.   How can I add a new Block In Drupal?
Answer:- Adding a new block is a simple process in drupal 6.
·         Go to Administer » Blocks and click on the Add Block link (tab).
·         Fill in the form with the necessary PHP/HTML code in the block body. And click the ‘Save Block’ button.
18.   What does Views do and how do you use it?
Answer:- Views is a practical necessity for sites built on Drupal 6, and it's imperative that your developer understands how to take advantage of it. Earl Miles has written a great summary on the Views project page.
19.   How can I create a custom region in my Drupal template?
Answer:- Adding a new region in your drupal template is not a hard thing, but its not as easy as adding a new block. It’s basically a two-step process:
·         define the custom region in your theme’s .info file
·         insert some PHP in your theme’s page.tpl.php file wherever you would like the new region to appear
20.   How can I add custom PHP codes in my Drupal pages or blocks?
Answer:- By default, drupal will not allow inserting PHP code directly inside a post or in a block. To do this, you need to activate a drupal module called PHP filter via, Administer » Site building » Modules. Even though this module ships with drupal, it remains disabled by default.
21.   How do I Remove Breadcrumbs from my Drupal pages?
Answer:- Breadcrumbs or breadcrumb trail is a navigation aid used in drupal interfaces. Normally it appears in between the top banner area and the page title. It gives users a way to keep track of their location within programs. Breadcrumbs are really useful in a comparatively bigger website with plenty of sections and subsections. But when it comes to smaller websites, it may found useless. In those cases you may either hide it using CSS (eg. .breadcrumb {display: none;}) or in the page.tpl.php file remove the line that says <?php if ($breadcrumb) print $breadcrumb; ?>
22.   How can I install Drupal on a local WAMP server?
Answer:- Preparing your computer with a local installation of Drupal with WampServer is comparatively a trouble-free process to follow. Since WampServer will install an Apache-server, SQL, PHP and phpMySQL on your computer, with those tools you can install and run Drupal locally even without an internet connection.
23.   How do I move a Drupal Site from One host/server to another?
Answer:- Migrating Drupal On your OLD host:
1) Backup your whole home directory from your ftp access using an ftp client like filezilla. Make a folder on your local harddisk and download the complete directory to that local folder.
2) Backup your mysql database on your old host using phpadmin, select your mysql database, usually something like "name_drpl1". Select all fields, click "export" and save the database to your local harddisk. Leave default options enabled. You will receive a file similar to "name_drpl1.sql".
This is your mysql database
On your NEW host:
1) Upload your folder with the complete drupal installation to your home-directory.
2) Once done, go to phpadmin on the new host, create a new mysql database, example "name_drpl1" and create a new mysql user. Create a password for this new mysql user, click "assign all privileges" to this user and assign the user to the new database.
You now should have a new mysql database on the new host with a mysql user, eg. "name_drpl1" as database name and "name_username" as database user name.
3) Import (upload) the database (which you exported from the old host earlier) with phpadmin to the new database. This might take a minute.
4) If needed edit the file [drupal home]/sites/default/settings.php and edit at the section where you enter the database, location, username and password. You CAN enter the password either encrypted or not encrypted there.
5) Chmod your "files" folder so it is writeable using your ftp client (filezilla), chmod to 777
6) Double check your .htaccess and [drupal home] /sites/default/settings.php and make changes in case they are needed.
Change nameserves on your domain host and let them point to your new host's nameservers.
Enter the new nameservers in your control panel where your domain names are hosted, overwriting the old ones.
After some time (sometimes a day or two) your domain should point to the new host and drupal should be up and running on the new host.
24.   How to backup my Drupal site?
Answer:- Backing up your Drupal site is now very easy, you just need to download and install a module called Backup & Migrate. To install the module click on the Administer » Modules check the Backup and Migrate module and enable it and save the settings.

Then navigate to the Administer » Content Management » Backup and Migrate then do the following settings.
·         Exclude the following tables altogether: select the table which you dont want to take backup.
·         Give the backup file name.
·         There are also options to compress the file before download, or add a datestamp.
·         And then click Backup Database.
Alternately you can take backups using PhpMyAdmin.
25.   How to Customize my Drupal Syndicate Feed Icon?
Answer:- For a recent project I needed to customize the feed icon in the Drupal theme I was creating. This wasn’t as straight forward as I thought it would be. Being the drupal newbie that I am I went looking for it in the core templates and suggestions page only to come empty handed.
Previously I found the solution to theming a search form by using the search-block-form.tpl.php template file and thought there would be one for the feed icon too. I found the solution to this in the function reference in the form of a theme hook.
theme_feed_icon($url, $title)
This function is internally called by drupal to generate the feed icon in the Syndicate block. Our Job is to override this function.
26.   How to interact with Drupal search system?
Answer:- There are three ways to interact with the search system:
Specifically for searching nodes, you can implement nodeapi (‘update index’) and nodeapi (‘search result’). However, note that the search system already indexes all visible output of a node, i.e. everything displayed normally by hook_view () and hook_nodeapi (‘view’). This is usually sufficient. You should only use this mechanism if you want additional, non-visible data to be indexed.
Implement hook_search (). This will create a search tab for your module on the /search page with a simple keyword search form. You may optionally implement hook_search_item () to customize the display of your results.
Implement hook_update_index (). This allows your module to use Drupal’s HTML indexing mechanism for searching full text efficiently.
If your module needs to provide a more complicated search form, then you need to implement it yourself without hook_search (). In that case, you should define it as a local task (tab) under the /search page (e.g. /search/mymodule) so that users can easily find it.
27.   Explain the menu system in Drupal? Purpose of menus?
Answer:- Define the navigation menus, and route page requests to code based on URLs.
The Drupal menu system drives both the navigation system from a user perspective and the callback system that Drupal uses to respond to URLs passed from the browser. For this reason, a good understanding of the menu system is fundamental to the creation of complex modules.  Drupal’s menu system follows a simple hierarchy defined by paths. Implementations of hook_menu () define menu items and assign them to paths (which should be unique). The menu system aggregates these items and determines the menu hierarchy from the paths. For example, if the paths defined were a, a/b, e, a/b/c/d, f/g, and a/b/h, the menu system would form the structure:
a
a/b
a/b/c/d
a/b/h
e
f/g
Note that the number of elements in the path does not necessarily determine the depth of the menu item in the tree.
When responding to a page request, the menu system looks to see if the path requested by the browser is registered as a menu item with a callback. If not, the system searches up the menu tree for the most complete match with a callback it can find. If the path a/b/i is requested in the tree above, the callback for a/b would be used.
The found callback function is called with any arguments specified in the “page arguments” attribute of its menu item. The attribute must be an array. After these arguments, any remaining components of the path are appended as further arguments. In this way, the callback for a/b above could respond to a request for a/b/i differently than a request for a/b/j.
For an illustration of this process, see page_example.module.
Access to the callback functions is also protected by the menu system. The “access callback” with an optional “access arguments” of each menu item is called before the page callback proceeds. If this returns TRUE, then access is granted; if FALSE, then access is denied. Menu items may omit this attribute to use the value provided by an ancestor item.
In the default Drupal interface, you will notice many links rendered as tabs. These are known in the menu system as “local tasks”, and they are rendered as tabs by default, though other presentations are possible. Local tasks function just as other menu items in most respects. It is convention that the names of these tasks should be short verbs if possible. In addition, a “default” local task should be provided for each set. When visiting a local task’s parent menu item, the default local task will be rendered as if it is selected; this provides for a normal tab user experience. This default task is special in that it links not to its provided path, but to its parent item’s path instead. The default task’s path is only used to place it appropriately in the menu hierarchy.
Everything described so far is stored in the menu_router table. The menu_links table holds the visible menu links. By default these are derived from the same hook_menu definitions, however you are free to add more with menu_link_save ().
28.   Explain the FCK Editor?
Answer:-  FCK  Module
29.   Explain Roles, User and Permissions?
Answer:-  Roles –
Roles allow you to fine tune the security and administration of Drupal. A role defines a group of users that have certain privileges as defined in user permissions. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the role names of the various roles. To delete a role choose "edit".
By default, Drupal comes with two user roles:
·         Anonymous user: this role is used for users that don't have a user account or that are not authenticated.
·         Authenticated user: this role is automatically granted to all logged in users.
User-
Drupal allows users to register, login, log out, maintain user profiles, etc. Users of the site may not use their own names to post content until they have signed up for a user account.
Permissions-
Permissions let you control what users can do on your site. Each user role (defined on the user roles page) has its own set of permissions. For example, you could give users classified as "Administrators" permission to "administer nodes" but deny this power to ordinary, "authenticated" users. You can use permissions to reveal new features to privileged users (those with subscriptions, for example). Permissions also allow trusted users to share the administrative burden of running a busy site.
30.   How develop custom modules?
Answer:- Name your module
The first step in creating a module is to choose a "short name" for it. This short name will be used in all file and function names in your module, so it must start with a letter and by Drupal convention it must contain only lower-case letters and underscores. For this example, we'll choose "onthisdate" as the short name. Important note: It is not just a convention that the short name is used for both the module's file name and as a function prefix. When you implement Drupal "hooks" (see later portions of tutorial), Drupal will only recognize your hook implementation functions if they have the same function name prefix as the name of the module file.
It's also important to make sure your module does not have the same short name as any theme you will be using on the site.
Create a folder and a module file
Given that our choice of short name is "onthisdate", start the module by creating a folder in your Drupal installation at the path: sites/all/modules/onthisdate. You may need to create the sites/all/modules directory first. Create a PHP file and save it as onthisdate.module in the directory sites/all/modules/onthisdate. As of Drupal 6.x, sites/all/modules is the preferred place for non-core modules (and sites/all/themes for non-core themes), since this places all site-specific files in the sites directory. This allows you to more easily update the core files and modules without erasing your customizations. Alternatively, if you have a multi-site Drupal installation and this module is for only one specific site, you can put it in sites/your-site-folder/modules.
The module is not operational yet: it hasn't been activated. We'll activate the module later in the tutorial.
Coding Standards
As per the Coding standards, omit the closing ?> tag. Including the closing tag may cause strange runtime issues on certain server setups. (Note that the examples in the handbook will show the closing tag for formatting reasons only and you should not include it in your real code.)
All functions in your module that will be used by Drupal are named {modulename}_{hook}, where "hook" is a pre-defined function name suffix. Drupal will call these functions to get specific data, so having these well-defined names means Drupal knows where to look. We will come to hooks in a while.

Link checker - Module

The Link checker module extracts links from your content when saved and periodically tries to detect broken hypertext links by checking the remote sites and evaluating the HTTP response codes. It shows all broken links in the reports/logs section and on the content edit page, if a link check has been failed. An author specific broken links report is also available in "My Account".

Features:

  • Selectively scan node types and comments
  • Selectively scan custom blocks
  • Scans CCK text and link fields in selected nodes
  • Checks internal and by default external links
  • Configurable link check intervals
  • Updates permanently moved (301) links after specified link check fail count
  • Unpublishes nodes after specified file not found (404) fail count
  • Weblink nodes from Links Package module are supported
  • Weblinks nodes from Weblinks module are supported
  • Output created by input filters is supported
  • Supported HTML elements: a, area, audio, embed, iframe, img, object, param, source, video
  • Supported link protocols: http, https
Read More....

Wednesday, November 21, 2012

Splash - Module

Display any internal path, external URL or text as a splash page before going to the actual frontpage.
Warning: 6.x-2.7 solves a caching issue but is now incompatible with Purl - I'm looking into a workaround for this.

Features since 6.x-2.x

  • Set the splash page to be displayed every week, day, once or always.
  • Use the condition module to further restrict when the splash page should be displayed (e.g. certain roles, PHP code).
  • Choose to display the splash page in a new window, by using ThickBox or by redirecting to the page.
  • Set the size of the window or ThickBox.
  • Let the module choose from a list of splash pages, either in random or sequence mode.
  • Enter a filtered text to be displayed as splash page, either in the site template or full screen.
  • Force display or skip splash page by calling the frontpage with ?splash=on/off. This is necessary to running cron on sites with the splash set to display on all pages:
    0 * * * * wget -O - -q -t 1 http://example.com/cron.php?splash=off
Read More.....

hide/remove the formatting guidelines and the link "More information about formatting options"

Add the following to template.php in themes/YourThemeName

/*
* Override filter.module's theme_filter_tips() function to disable tips display.
*/
function YourThemeName_filter_tips($tips, $long = FALSE, $extra = '') {
  return '';
}
function YourThemeName_filter_tips_more_info () {
  return '';
}
 Note :
add this code below <?php
Don't forget to change YourThemeName to your thee name
Don't forget to clear the template cache in your site Administer->Site Configuration->Performance->Clear Cached Data.
worked for drupal 6.19. 

Tuesday, November 20, 2012

Better Formats - Module

Better formats is a module to add more flexibility to Drupal's core input format system.

Features

6.x

  • Set the default format per role.
  • Set the default format per content type.
  • Control allowed formats per content type.
  • Hide format tips.
  • Hide more format tips link.
  • Hide format selection for nodes, comments, and blocks seperately, forcing the default to be used.
  • Expand the selection fieldset by default.
  • Disable the expand/collapse of the selection fieldset.
  • Set selection fieldset title.
  • Set more format tips link text.
  • Set default formats for nodes and comments separately.
  • Sensible defaults and fail overs for ease of use.
  • Works with CCK textareas.
  • Works with Panels comment form.
  • i18n module support for user defined strings.
Read More....

only show translated menu items into current language (Drupal 8)

function MY_THEME_preprocess_menu(&$variables) {   if ($variables['menu_name'] == 'brancott-header-menu') {    $langu...