drupal

Garland secondary-links wrapping in IE

Question: 
How to stop secondary links wrapping in IE?

Within the Garland theme the secondary links have a bug in that they wrap. A quick fix is to change page.tpl.php as follows:

- <?php print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?>
+ <?php print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?>

Next and Previous Links for Views Listing in Drupal

Question: 
How to implement Next and Previous Links for Views Listing

Custom Pagers Module

Custom Pagers module allows administrators to define context-sensitive previous/next pagers for any node type. The list of nodes to be cycled through is generated by a user-selectable view, and each pager can be displayed above or below the node body or in a sidebar block. This makes it possible to duplicate the paging functions of forum.module and book.module, as well as more complex stuff like comic strip navigation. Requires token.module and views.module.

http://drupal.org/project/custom_pagers

Restrict Parent Menu Options

Question: 
How to restrict parent menu options to relevant items when adding a new page

When a content author adds a node they are typically required to select a parent item.

However, the default display of parent menu options shows items that are irrelevant and confusing.

Therefore, it is more user friendly to show only the menu items of relevance. This can be achieved by only displaying a specific menu and its items through use of the module Menu Settings per Content Type.

Migrate webform data to another database

Question: 
How to migrate webform data

The webform module creates the following tables:

  • webform
  • webform_component
  • webform_roles
  • webform_submissions
  • webform_submitted_data

Therefore to migrate backup these tables and then import them into the other database using the backup and migrate module.

Note:

1. A new row is created within webform_submissions for each new submission. The field 'sid' is a unique field which is incremented for each new submission.

Workaround for the duplicate Content-Type meta tag in Drupal

Question: 
How to stop duplicate Content-Type meta tag in Drupal?

<?
$head = str_replace('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />', '', $head);
print $head
?>

Note the variable $head prints content-Type meta tag twice. Using the above code simply replaces the first occurance with nothing - i.e. removes it.

Make http:// goto http://www and get rid of trailing slashes

Question: 
How to make http:// goto http://www and get rid of trailing slashes

Update the .htaccess file as described below.

# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
RewriteCond %{HTTP_HOST} ^villa-la-herradura\.com$ [NC]
RewriteRule ^(.*)$ http://www.villa-la-herradura.com/$1 [L,R=301]

#get rid of trailing slashes
RewriteCond %{HTTP_HOST} ^(www.)?villa-la-herradura\.com$ [NC]
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

XML Sitemap

Question: 
How to set-up an XML sitemap / site map

This module make the process nice and easy:

http://drupal.org/project/xmlsitemap

Collapse the menu fieldset by default

Question: 
How to collpase the menu fieldset by default

Within your template.php file enter the following:


function yourthemename_node_form($form) {
// Collapse fieldsets
$form_elements = element_children($form);
foreach ($form_elements as $element) {
if ($form[$element]['#type'] == 'fieldset') { //Identify fieldsets and collapse them
$form[$element]['#collapsible'] = TRUE;
$form[$element]['#collapsed'] = TRUE;
}
}
return drupal_render($form);
}

Split Drupal content into two columns

Question: 
How to split Drupal content into two columns

The example below will split the variable $content into an array $column[0], $column[1] and so forth.

The split will occur where <span class="split"></span> is located.

$columns = preg_split('/<span class="split"><\/span>/i', $content);

To print the columns simply use:

print $column[0]
print $column[1]

Custom Front Page with the Views Module

Question: 
Custom Front Page with the Views Module

Custom Front Page with the Views Module

If you have the Views Module installed, it will create a front page view located at http://example.com/frontpage. You can control the settings for that page at http://example.com/admin/build/views.

To edit the View for this type of custom front page, go to http://example.com/frontpage and click on the "Override" tab. Then create a Drupal View just as you would create any other Drupal View.

If you have the Views Module installed, be sure to block off that duplicate front page with the following robots.txt rule:

Disallow: /frontpage$