theming

In drupal 7 the recommended method to render output is by using the render api. So no more calling theme(...) directly. Here is a simple example based on the example from the examples module.

<?php

function render_something() {
  
$render_array = array(
    
'child' => array(
      
t('This is some text that should be put together'),
      
t('This is some more text that we need'),
    ),
?>

If you want to render only one field of your entities you can in drupal 7. Here in the example we have an entity called model which contains an image field.

To render the field you have to specify to the field_attach_view function which entity type, the entity and the view mode you want to use. The function returns a renderable array.

Dont print labels hardcoded in your templates, they are configurable by interface.
http://thedrupalblog.com/getting-cck-field-labels

How to add another formatter to a cck field? A cck formatter is basically a theming function where the value of field is ran through. Formatters are available at "admin/content/node-type/[your node type]/display" in the cck interface.

What it does

With this module you can theme your nodes by interface in a easy user friendly way (unlike panels, which can do pretty much what ds can but with a million clicks more).
The display suite is collection of modules all sharing the same api, the modules that implement the api are:

This module has the potential to fill the form theming gap. For now it is still in alpha but it has potential.
It uses jquery to arrange your form elements. Takes into account fieldset (but not the field in the fieldsets).
It does not integrate with the multistep module.

http://drupal.org/project/arrange_fields

A solution is suggested here:

http://drupal.org/node/61728

It didnt work for me probably cause I had set up a multi site.
What did I do:
- upload all favicons by ftp to the files folder
- manualy filled in the path files/my_favicon.ico at admin/build/themes/setting/name_of_theme and save

and this worked...

When I used the upload button it didnt work. I didnt investigate it further why my method worked and the other didnt,... (feel free to contact me)

This article explains how to switch your theme. In our example we will switch the theme if one of the fields of our node has a certain value.
Use hook_init() to accomplish this.

<?php
function thuis_sanitech_extra_init() {
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    global $user;
 
    if ($node->field_theme_keuze[0]['value'] == 1) {
      //load appropriate theme
      $user->theme = 'affaires';
      init_theme();
    }

You have a node type containing an image field. You want to construct a feed containing the image (and node title) but the image needs to be resized to a format you dont use on the site.

Here is how to do it:

Use imagecache module
Create a preset.
Construct the url where the image would be if the image cache module would generate it. This is the url you will put in your feed.

Syndicate content