Verwirrung: Template oder Theme?
am 24.12.2009 - 11:20 Uhr in
Hallo,
ich programmiere gerade ein eigenes Modul um mich in Drupal einzuarbeiten und möchte jetzt die Funktionen vom optischen trennen. Ich hab das immer so verstanden, dass das Theme die generelle optische Gestaltung der Website ist, das Look&Feel. Ein Template ist ne Datei die die Ausgabe eines einzelnen Moduls regelt.
Wenn ich jetz hier auf der Website danach suche wie ich Templates anwende, finde ich eigentlich nur Zeug über Themes.
Heisst das bei drupal irgendwie anders als sonstwo?
Und könnt ihr mir kurz einen Link zu nem Tutorial geben in dem ich sehen kann wie ich Funktionalität von grafischem trennen kann?
thx und frohe Weihnachten
MaWe
- Anmelden oder Registrieren um Kommentare zu schreiben

Hast du das schon
am 24.12.2009 - 11:27 Uhr
Hast du das schon gelesen?
http://www.drupalcenter.de/handbuch/15663
Eine Template-Datei ist Teil eines Themes.
Schon zuständig für die Ausgabe aber nicht eines einzelnen Moduls...
-----------
Kooperative Netze Hamburg
Theme-Layer in Modulen verwenden
am 24.12.2009 - 13:45 Uhr
Siehe dazu auch Using the theme layer (bzw. die übersetzte Fassung Die Verwendung der Theme-Schicht).
Stefan
--
Sei nett zu Deinem Themer!
hmm.. also so recht werd ich
am 24.12.2009 - 22:16 Uhr
hmm.. also so recht werd ich nicht schlau draus, hab noch nie was mit templates gemacht :/
Bis jetzt hab ich das ganze in nem testmodul ohne Template gemacht.
Drei Dateien, testmodule.info, testmodule.install, testmodule.module
ich denk die info und install sind ok soweit, die testmodule.module ist allerdings fragwürdig, sie beinhaltet zwei blocks mit insgesamt 4 links zu 4 zielen.
Hier mal der Inhalt, hoffe es ist nicht zu viel:
<?php
// $Id$
function testmodule_help($path, $arg){
$output = '';
switch($path){
case "admin/help#testmodule":
$output = '<p>'.t("This is the Testmodule").'</p>';
break;
}
return $output;
}
function testmodule_perm(){
return array('access testmodule content','administer testmodule');
}
function testmodule_block($op = 'list', $delta = 0){
if($op == "list"){
$block[0]["info"]=t('Testblock 0');
$block[1]["info"]=t('Testblock 1');
return $block;
}else if ($op == 'view'){
$block_content = '';
switch($delta){
case 0:
$block['subject'] = 'Testblock 0';
//Menu-link to Testlink 0-0
$options = array('attributes' => array('title'=> t('This is testlink 0-0')));
$block_content .= l(t('Testlink 0-0'),'testlink00',$options).'<br />';
//Menu-link to Testlink 0-1
$options = array('attributes' => array('title'=> t('This is testlink 0-1')));
$block_content .= l(t('Testlink 0-1'),'testlink01',$options).'<br />';
break;
case 1:
$block['subject'] = 'Testblock 1';
//Menu-link to Testlink 1-0
$options = array('attributes' => array('title'=> t('This is testlink 1-0')));
$block_content .= l(t('Testlink 1-0'),'testlink10',$options).'<br />';
//Menu-link to Testlink 1-1
$options = array('attributes' => array('title'=> t('This is testlink 1-1')));
$block_content .= l(t('Testlink 1-1'),'testlink11',$options).'<br />';
break;
}
$block['content'] = $block_content;
return $block;
}
}
function testmodule_menu(){
$items = array();
$items['testlink00']=array(
'title' => t('Testlink 0-0'),
'page callback' => 'testlink00_all',
'access arguments' => array('access testlink content'),
'type' => MENU_CALLBACK
);
$items['testlink01']=array(
'title' => t('Testlink 0-1'),
'page callback' => 'testlink01_all',
'access arguments' => array('access testlink content'),
'type' => MENU_CALLBACK
);
$items['testlink10']=array(
'title' => t('Testlink 1-0'),
'page callback' => 'testlink10_all',
'access arguments' => array('access testlink content'),
'type' => MENU_CALLBACK
);
$items['testlink11']=array(
'title' => t('Testlink 1-1'),
'page callback' => 'testlink11_all',
'access arguments' => array('access testlink content'),
'type' => MENU_CALLBACK
);
return $items;
}
function testlink00_all(){
$page_content = t('This is Testlink 0-0');
$page_content .= drupal_get_form('testlink00_form');
return $page_content;
}
function testlink01_all(){
$page_content = t('This is Testlink 0-1');
$page_content .= drupal_get_form('testlink01_form');
return $page_content;
}
function testlink10_all(){
$page_content = t('This is Testlink 1-0');
$page_content .= drupal_get_form('testlink10_form');
return $page_content;
}
function testlink11_all(){
$page_content = t('This is Testlink 1-1');
$page_content .= drupal_get_form('testlink11_form');
return $page_content;
}
function testlink00_form($form_state) {
return testlinkforms('00');
}
function testlink01_form($form_state) {
return testlinkforms('01');
}
function testlink10_form($form_state) {
return testlinkforms('10');
}
function testlink11_form($form_state) {
return testlinkforms('11');
}
function testlinkforms($module) {
// Description
$form['testform'] = array(
'#type' => 'fieldset',
'#title' => t('Testform'),
);
$query = "SELECT * FROM {testmodule} as tm WHERE tm.test_module='%s'";
$qRes = db_query($query,$module);
while($test = db_fetch_object($qRes)){
$form['testform']['test_id_'.$test->test_id] = array(
'#type' => 'checkbox',
'#title' => $test->test_module.'('.$test->test_id.')',
'#default_value' => ($test->test_module==$module)?1:0,
);
}
$form['hidden'] = array('#type' => 'value', '#value' => 'testvalue');
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
return $form;
}
?>
Auf welche Dateien müsste ich das Ganze jetzt verteilen und wie würden die aussehen, damit das sauberer wird?
Diese _all - Methoden muss ich vermutlich überarbeiten, aber was muss da stattdessen rein?
Momentan würde ich da jeglichen HTML-Code unterbringen
Mit hook_theme definierst du
am 24.12.2009 - 22:45 Uhr
Mit hook_theme definierst du Templates bzw. Theme-Funktionen.
----------------------------------------
Gelöste Forenbeiträge mit [gelöst] im Titel ergänzen
Das Verhältnis anderen zu helfen muss höher sein, als von anderen Hilfe zu erfragen/erwarten.