Base CSS and tpl files don't get loaded (sub-theme with page.tpl.php)
authorJohnAlbin
Tue, 6 Nov 2007 00:49:21 +0000 (00:49 +0000)
committerJohnAlbin
Tue, 6 Nov 2007 00:49:21 +0000 (00:49 +0000)
CHANGELOG.txt
zen_classic/page.tpl.php [new file with mode: 0644]
zen_classic/template.php
zen_classic/zen-subtheme.php [new file with mode: 0644]

index 4fc95a3..402184d 100644 (file)
@@ -1,4 +1,5 @@
 Zen 5.x-1.x-dev
+  * Base CSS and tpl files don't get loaded (sub-theme with page.tpl.php)
   * Create starter theme; migrate current style to a sub-theme
   * Added ability to change regions in a sub-theme
   * Added complete Drupal 5 CSS for easy reference by theme developers
diff --git a/zen_classic/page.tpl.php b/zen_classic/page.tpl.php
new file mode 100644 (file)
index 0000000..25cd0ec
--- /dev/null
@@ -0,0 +1,123 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language ?>" xml:lang="<?php print $language ?>">
+
+<head>
+  <title><?php print $head_title; ?></title>
+  <?php print $head; ?>
+  <?php print $styles; ?>
+  <?php print $scripts; ?>
+</head>
+
+<?php /* different classes allow for separate theming of the home page */ ?>
+<body class="<?php print $body_classes; ?>">
+  <div id="page">
+    <div id="header">
+
+      <div id="skip-nav"><a href="#content"><?php print t('Skip to Main Content'); ?></a></div>
+
+      <div id="logo-title">
+
+        <?php print $search_box; ?>
+        <?php if (!empty($logo)): ?>
+          <a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>" rel="home">
+            <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" id="logo" />
+          </a>
+        <?php endif; ?>
+
+        <div id="name-and-slogan">
+
+        <?php if (!empty($site_name)): ?>
+          <div id='site-name'><strong>
+            <a href="<?php print $base_path ?>" title="<?php print t('Home'); ?>" rel="home">
+              <?php print $site_name; ?>
+            </a>
+          </strong></div>
+        <?php endif; ?>
+
+        <?php if (!empty($site_slogan)): ?>
+          <div id='site-slogan'>
+            <?php print $site_slogan; ?>
+          </div>
+        <?php endif; ?>
+
+        </div> <!-- /name-and-slogan -->
+
+      </div> <!-- /logo-title -->
+
+      <div id="navigation" class="menu<?php if ($primary_links) { print " withprimary"; } if ($secondary_links) { print " withsecondary"; } ?> ">
+        <?php if (!empty($primary_links)): ?>
+          <div id="primary" class="clear-block">
+            <?php print theme('links', $primary_links); ?>
+          </div>
+        <?php endif; ?>
+
+        <?php if (!empty($secondary_links)): ?>
+          <div id="secondary" class="clear-block">
+            <?php print theme('links', $secondary_links); ?>
+          </div>
+        <?php endif; ?>
+      </div> <!-- /navigation -->
+
+      <?php if (!empty($header) || !empty($breadcrumb)): ?>
+        <div id="header-region">
+          <?php print $breadcrumb; ?>
+          <?php print $header; ?>
+        </div> <!-- /header-region -->
+      <?php endif; ?>
+
+    </div> <!-- /header -->
+
+    <div id="container" class="clear-block">
+
+      <?php if (!empty($sidebar_left)): ?>
+        <div id="sidebar-left" class="column sidebar">
+          <?php print $sidebar_left; ?>
+        </div> <!-- /sidebar-left -->
+      <?php endif; ?>
+
+      <div id="main" class="column"><div id="squeeze" class="clear-block">
+        <?php if (!empty($mission)): ?>
+          <div id="mission"><?php print $mission; ?></div>
+        <?php endif; ?>
+        <?php if (!empty($content_top)):?>
+          <div id="content-top"><?php print $content_top; ?></div>
+        <?php endif; ?>
+        <div id="content">
+          <?php if (!empty($title)): ?>
+            <h1 class="title"><?php print $title; ?></h1>
+          <?php endif; ?>
+          <?php if (!empty($tabs)): ?>
+            <div class="tabs"><?php print $tabs; ?></div>
+          <?php endif; ?>
+          <?php print $help; ?>
+          <?php print $messages; ?>
+          <?php print $content; ?>
+          <?php if (!empty($feed_icons)): ?>
+            <div class="feed-icons"><?php print $feed_icons; ?></div>
+          <?php endif; ?>
+        </div> <!-- /content -->
+        <?php if (!empty($content_bottom)): ?>
+          <div id="content-bottom"><?php print $content_bottom; ?></div>
+        <?php endif; ?>
+      </div></div> <!-- /squeeze /main -->
+
+      <?php if (!empty($sidebar_right)): ?>
+        <div id="sidebar-right" class="column sidebar">
+          <?php print $sidebar_right; ?>
+        </div> <!-- /sidebar-right -->
+      <?php endif; ?>
+
+    </div> <!-- /container -->
+
+    <div id="footer-wrapper">
+      <div id="footer">
+        <?php print $footer_message; ?>
+      </div> <!-- /footer -->
+    </div> <!-- /footer-wrapper -->
+
+    <?php print $closure; ?>
+
+  </div> <!-- /page -->
+
+</body>
+</html>
\ No newline at end of file
index 4601f21..1c141ee 100644 (file)
  */
 
 
+/*
+ * Sub-themes with their own page.tpl.php files are seen by PHPTemplate as their
+ * own theme (seperate from Zen). So we need to re-connect those sub-themes
+ * with the main Zen theme.
+ */
+include_once 'zen-subtheme.php';
+
+
 /**
  * Intercept template variables
  *
diff --git a/zen_classic/zen-subtheme.php b/zen_classic/zen-subtheme.php
new file mode 100644 (file)
index 0000000..7e78803
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+// $Id$
+
+/*
+ * If your sub-theme has its own page.tpl.php file, copy this file to your
+ * sub-theme's directory and include it using this line of code:
+ *
+ *   include_once('zen-subtheme.php');
+ *
+ * Sub-themes with their own page.tpl.php files are seen by PHPTemplate as their
+ * own theme (seperate from Zen). So we need to re-connect those sub-themes with
+ * the base Zen theme.
+ */
+global $theme, $theme_key;
+if ($theme != 'zen' && $theme == $theme_key) {
+
+  // Extract current files from database.
+  $themes = list_themes();
+
+  // Update database
+  $parent_path = $themes['zen']->filename;
+  $subtheme_path = str_replace('page.tpl.php', 'style.css', $themes[$theme]->filename);
+  db_query("UPDATE {system} SET description='%s', filename='%s' WHERE name='%s'", $parent_path, $subtheme_path, $theme);
+
+  // Refresh Drupal internals.
+  $theme = 'zen';
+  $themes = list_themes(TRUE);
+
+  $zen_path = dirname($parent_path);
+  if (file_exists($zen_path .'/template.php')) {
+    include_once($zen_path .'/template.php');
+  }
+}