Questions tagged [drupal-theming]

In Drupal terminology, "theming" is rendering or modifying the HTML markup produced by a module or a theme.

Drupal theming system allows a theme to have nearly complete control over the appearance of the site, which includes both the markup and the CSS used to style the markup. For this system to work, modules, instead of writing HTML markup directly, need to return render arrays, which are structured hierarchical arrays that include the data to be rendered into HTML (or XML or another output format), and options that affect the markup. Render arrays are ultimately rendered into HTML or other output formats by recursive calls to drupal_render(), traversing the depth of the render array hierarchy. At each level, the theme system is invoked to do the actual rendering. See the documentation of drupal_render() and the Theme system and Render API topic for more information about render arrays and rendering.

Reference

822 questions
85
votes
10 answers

How to quickly theme a view?

I've defined a view with the CCK and View 2 modules. I would like to quickly define a template specific to this view. Is there any tutorial or information on this? What are the files I need to modify? Here are my findings: (Edited) In fact, there…
Pierre-Jean Coudert
  • 9,109
  • 10
  • 50
  • 59
36
votes
15 answers

How to insert a block into a node or template in Drupal 7?

In Drupal 6, it was easy to insert a block into a template with the following code: $block = module_invoke('views', 'block', 'view', 'block_name'); print $block['content']; However, using the same instructions in Drupal 7 does not seem to work. I…
Randy Burgess
  • 4,835
  • 6
  • 41
  • 59
36
votes
2 answers

How do I use theme preprocessor functions for my own templates?

I have several .tpl.php files for nodes, CCK fields, and Views theming. These template files have a lot of logic in them to move things around, strip links, create new links, etc. I understand that this is bad development and not "The Drupal…
Jamison Dance
  • 19,896
  • 25
  • 97
  • 99
34
votes
10 answers

Adding a class to "body"

How can I modify or pre-process the tag to add the class body? I don't want to create a whole html.tpl.php just to add a class.
Chris Muench
  • 17,444
  • 70
  • 209
  • 362
29
votes
9 answers

How do I get the path of the current drupal theme?

The Drupal API has drupal_get_path($type, $name) which will give the path of any particular theme or module. What if I want the path of the current theme?
Steven Noble
  • 10,204
  • 13
  • 45
  • 57
21
votes
10 answers

How do I output a drupal image field?

It is quite possible that I'm just looking for help finding the name of a function that already exists within drupal (7) but sometimes the documentation is a bit difficult to navigate. Hopefully someone can help me. I have a node that has a custom…
Alex C
  • 16,624
  • 18
  • 66
  • 98
15
votes
3 answers

preprocess Vs. process functions in drupal template

What is the difference between function mythemes_preprocess_html(&$variables) { ... } and function mythemes_process_html(&$variables) { ... } in drupal 7 template.php. when must use preprocess functions and when must use process functions. thanks.
Questioner
  • 225
  • 4
  • 10
15
votes
8 answers

Drupal 7 How to override page.tpl for specific content type?

I wanted to override page.tpl.php for specific content type. I have tried these thing, nothing works for…
Rahul Prasad
  • 8,074
  • 8
  • 43
  • 49
12
votes
5 answers

how to check if the user is in the admin part of drupal?

How do i check if the current page is in the admin section of drupal?. I want to display a login form in some pages from the main menu but the login page is displayed in the block selection menu .Please suggest a solution ..
Sreejith Sasidharan
  • 1,318
  • 5
  • 25
  • 46
11
votes
5 answers

Drupal 7 - How to load a template file from a module?

I am trying to build my own module in Drupal 7. So I have created a simple module called 'moon' function moon_menu() { $items = array(); $items['moon'] = array( 'title' => '', 'description' => t('Detalle de un Programa'), …
Moon
  • 22,195
  • 68
  • 188
  • 269
11
votes
2 answers

Drupal 7: Access custom node field in page.tpl.php

I added a new field "mood" (image) to the page content type. Is there any way to access the image stored in this field in the page.tpl.php?
dantz
  • 1,842
  • 4
  • 21
  • 25
11
votes
4 answers

Custom 404 template file in Drupal 8

How can I create a custom 404 page in Drupal 8? I have created a new page(Content) in the backoffice called 404 (node number 100). I have set it as the 404 default page at Configuration > Basic site settings. It works with the content that I have…
cadev
  • 123
  • 1
  • 2
  • 9
11
votes
1 answer

How to implement hook_theme in drupal 7?

I created a new drupal 7 theme and trying to implement hook_theme at template.php like this: function mytheme_theme($existing, $type, $theme, $path){ return array( 'mytheme_header'=>array( 'template'=>'header', …
solomon_wzs
  • 1,711
  • 5
  • 16
  • 29
10
votes
1 answer

Style Drupal 7 log-in page

How do I style the login-page of Drupal 7? I used different methods like page-user-login.tpl or user-login.tpl of page-login.tpl but with no results. Is there an easy way to theme your login page in Drupal 7 in his own .tpl-file?
Michiel
  • 7,855
  • 16
  • 61
  • 113
8
votes
4 answers

change the active Drupal 7 theme programmatically

What is the correct way to change the active Drupal 7 theme programmatically? I used $custom_theme in Drupal 6 but it is not working in Drupal 7.
Prajila V P
  • 5,027
  • 2
  • 23
  • 36
1
2 3
54 55