Oct
11
2011
0

Alter the node add form in Drupal 7

If you want to change the Save button text to Submit in Drupal 7 add the following to your template.php file.

Simply replace YOURTHEME with the name of your theme and CONTENTTYPE to the machine name of your content type.

 

 

 

 

function YOURTHEME_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == ‘CONTENTTYPE_node_form’) {
$form['actions']['submit']['#value'] = t(‘Submit’);
}
}

 

Written by Pete in: Drupal | Tags: , ,
Aug
01
2011
0

Printing CCK Fields in Drupal 7

In node.tpl.php

<?php print render($content['field_EXAMPLE']); ?>
<?php print render($content['body']); ?>

In page.tpl.php

<?php print $node->field_EXAMPLE['und'][0]['value']; ?>

Written by Pete in: Drupal |
Jul
11
2011
0

Notice: Undefined variable: site_name_and_slogan in include()

Drupal 7x

If you have copied the Garland theme and renamed the directory and garland.info file you need to change all references of garland in the template.php file to your new theme name.

Written by Pete in: Drupal |
Feb
28
2011
8

JQuery Not Working in Drupal 7

If when converting a theme to Drupal 7 you get the following Javascript errror in your JQuery:

$ is not a function

This is because Drupal 7 improves compatability with other Javascript libraries so you need to put the following wrapper around your code:


(function ($) {

//your existing code

})(jQuery);

Written by Pete in: Drupal |
Jan
05
2009
2

Drupal CCK Autonumber Field

In a Drupal site you may have a content type that needs an auto number to be generated that auto increments on each new node of that type.

To do this install the computed field module

http://drupal.org/project/computed_field

Then create a new field of the type computed field and add the code from the following URL

http://drupal.org/node/313110

Written by Pete in: Drupal,php |
Oct
17
2008
0

Removing Spam From a Drupal Website

For WordPress the integration with Akismet is an ideal solution for removing spam comments from your website. Until recently this tight integration was not available for Drupal. While Akismet was available for Drupal it lacked some of the abilities that WordPress included.

This was until Mollom became available for Drupal, designed by Dries Buytaert, the founder of Drupal. Mollom works in a similar way to Akismet however has tight integration with Drupal. A free version is available for smaller sites and a professional version for busier sites costing 30 Euros/month.

For more about Mollom visit:

www.mollom.com

For more about Drupal visit:

www.drupal.org

I have tested Mollom on a number of client sites and will be implementing it soon on our parent website, www.imafish.co.uk .

Written by Pete in: Drupal |
Oct
08
2008
0

Increase the memory available to PHP

If you get out of memory errors in PHP or if Drupal suggests you increase the memory available to PHP then you can do this with the following line of code:

ini_set('memory_limit','16M');

In Drupal the best place to put this is in the settings.php file found in sites/default/

Written by Pete in: Drupal,php |
Oct
07
2008
0

Drupal 6 Reloads the Database Page on Installation

When installing Drupal 6 if you find the database page keeps reloading when you enter the database details try to enter the username/password and database name directly into sites/default/settings.php

For some reason even when setting the settings.php file to writable Drupal cannot write to it which is why you need to enter it manually.

Written by Pete in: Drupal |

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes