Drupal: Content Type templates -


it possible choose different templates when creating new node?

for example: when want create node of content type product, want choose between 4 different templates.

i have 2 answers:

1) create cck field user choose template use, (e.g. field_template), , add snippet in template.php:

function mytheme_preprocess_node(&$vars) {   if (!empty($vars['field_template'][0]['value'])) {     array_unshift($vars['template_files'], 'node-' . $vars['field_template'][0]['value']);   } } 

that try use node-template.tpl.php template file, , fallback node.tpl.php if doesn't find it.

2) create taxonomy content type, , design taxonomy (something code above, little modified).


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -