Correct Markup with CCK (Drupal Quick Tip)

The Drupal Content Construction Kit allows you to create custom content types rather then relying on the default ones. It is an amazing feature and can add real flexibility to the system.

One issue that is often over looked is adding correct markup to the html that the system generates. When you add a custom content type with custom fields, you may notice that your content is not surrounded by <p> tags. You may also notice that Drupal does not recognise line breaks.

This is probably because you have selected Plain text under Text Processing. This must be set to Filtered text, which will add <p> tags to paragraphs and line breaks. You can also manually add HTML in the fields by selecting Full HTML as the input format. The input format will appear under each text field once you set the text processing to filtered text.

To check your current content types, go to:
Administer » Content management » Content types
Click on a relevant content type and the go to manage fields. Click on configure and then scroll down until you find text processing.

Post new comment

The content of this field is kept private and will not be shown publicly.

Learn how to write custom Drupal modules

Does Drupal module development make your head explode and drive you crazy?

Why not learn from someone who has paved the way instead?

Sign up to Master Drupal 7 Module Development.

Hello!!

I am Blair Wadman and this is where I write about Drupal, PHP, CSS etc

Stuff

Syndicate

Syndicate content

© Blair Wadman
2005 - 2011