De supersnelle ronde
Structuur van een template:
1// Structuur van een template:
- html.tpl.php verplicht
- page.tpl.php verplicht
- naamtemplate.info verplicht
- style.css verplicht
- screenshot.png aangeraden
- images (map) standaard
- node.tpl.php optioneel
- node-inhoudstype.php optioneel
- block.tpl.php optioneel
- comment.tpl.php optioneel
CSS
1// check of het css-bestand style.css heet
screenshot.png
2// maak een screenshot van de lay-out en sla op als screenshot.png (300px breed – liefst ook nog 220px hoog)
template.info (wijzig template in de naam van de template)
3// maak een bestand en sla op als naam-template.info.
Inhoud:
; $Id$
name = Leeg
description = Beschrijving
core = 7.x
engine = phptemplate
stylesheets[all][] = style.css
eventueel ook nog:
regions[highlighted] = highlighted
regions[sidebar_first] = sidebar first
regions[sidebar_second] = sidebar second
regions[content] = content
regions[help] = help
regions[header] = header
regions[footer] = footer
html.tpl.php
4// steeds identiek deze code:
<?php // $Id$ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>" <?php print $rdf_namespaces; ?>>
<head profile="<?php print
$grddl_profile; ?>">
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $scripts; ?>
</head>
<body class="<?php
print $classes; ?>" <?php print $attributes; ?>>
<?php print $page_top; ?>
<?php print $page; ?>
<?php print $page_bottom; ?>
</body>
</html>
page.tpl.php
5// Open layout.html en sla op als page.tpl.php.
Gebruik layout.html om nog wijzigingen aan te brengen in de CSS.
De linkerdiv (sidebar first):
<?php if ($page['sidebar_first']):
?>
<div id="sidebar-first" class="sidebar">
<?php print render($page['sidebar_first']); ?>
</div>
<?php endif; ?>
De rechterdiv (sidebar second):
<?php if ($page['sidebar_second']):
?>
<div id="sidebar-second" class="sidebar">
<?php print render($page['sidebar_second']); ?>
</div>
<?php endif; ?>
De footer:
<?php print $feed_icons ?>
<?php print render($page['footer']); ?>
De inhoud:
<?php print $breadcrumb; ?> <a id="main-content"></a> <?php if ($tabs): ?><div id="tabs-wrapper" class="clearfix"><?php endif; ?> <?php print render($title_prefix); ?> <?php if ($title): ?> <h1<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php print $title ?></h1> <?php endif; ?> <?php print render($title_suffix); ?> <?php if ($tabs): ?><?php print render($tabs); ?></div><?php endif; ?> <?php print render($tabs2); ?> <?php print $messages; ?> <?php print render($page['help']); ?> <?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?> <div class="clearfix"> <?php print render($page['content']); ?>
(6//) Eventueel node.tpl.php voor de opmaak van de volledige node.
Eventueel node-artiest.tpl.php voor de opmaak van inhoudstype artiest (volledige node).