Thursday, October 19, 2017 08:50 am EDT

template.php

Bri's picture

Preserving Line Breaks Using Plain Text Processing for Drupal 7

Have you ever wanted to use the plain text option under the "Text processing" selection for a textarea control on a form so that your users don't see the options that they get when you choose "Filtered text?"

Bri's picture

Theming the Contact Form in Drupal 7 (contact_site_form)

Theming the contact form in Drupal 7 is almost the same as most people did it in Drupal 6, but the one change through me for a loop for quite awhile.

Using Drupal 6, most people would add some code to their template.php file and create something like the following:

DRUPAL 6

function myTheme_theme() {
  return array(
	'contact_mail_page' => array(
					'arguments' => array('form' => NULL),
					'template' => 'contact-form',
					),
	);
}
function myTheme_preprocess_contact_mail_page(&$vars)
{
	$vars['name'] = drupal_render($vars['form']['name']);	
Bri's picture

Theming Drupal 6 Login Form or Login Block

Often times people want to theme the drupal login page or the login block for the theme they are using. If you need to go beyond just changing the CSS and want to actually add markup to the login form, this will show you how.

First you are going to need to locate the template.php file in your theme folder. We need to add some code to that file. Open up the template.php file for your theme and add the following:

Bri's picture

Creating Drupal Template Suggestions

Chances are that you have wanted to create a new template as you work on your Drupal sites. Perhaps the blog page needs to have some markup that varies from your typical page.tpl.php template. Adding some lines of code to the template.php file inside the theme you are using can help you achieve this. By default Drupal will look for templates that match the name of a content type. For example, if you created a template called node-blog.tpl.php, Drupal would recognize it and load it on pages that contained blog content.

Syndicate content